import { map } from "https://deno.land/x/ahh@v0.14.0/src/option.ts";
Returns the result of fn
appied to the value of option
, if it is a
Some
.
Examples
Example 1
Example 1
import { assert } from "../test_deps.ts";
import O from "./option.ts";
const toString = (i: number): string => i.toString();
assert(O.map(2, toString) === "2");
assert(O.map(undefined, toString) === undefined);
assert(O.map(null, toString) === null);
Type Parameters
U extends Some<unknown>