Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

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

Idiomatic type-safety structures for TypeScript.
Go to Latest
method R.map
import { R } from "https://deno.land/x/ahh@v0.10.0/src/result/mod.ts";

Calls f with res, and returns the result.

Examples

import { 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