Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/ahh/src/result/mod.ts>map

Opinionated idiomatic type-safety functions.
Go to Latest
function map
import { map } from "https://deno.land/x/ahh@v0.11.0/src/result/mod.ts";

Calls f with res, and returns the result.

Examples

Example 1

import { default as R } from "./mod.ts";

console.log(R.map(1, (i) => i + 1)); // 2
console.log(R.map(Error(), (i: number) => i + 1)); // Error()

Type Parameters

T
U
E extends Error

Parameters

res: Result<T, E>
f: (_: T) => U