Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

map

import { map } from "https://raw.githubusercontent.com/baetheus/fun/main/option.ts";

Apply the mapping function fai to the inner value of an Option if it exists. If the option is None then this function does nothing.

@example
import * as O from "./option.ts";
import { pipe } from "./fn.ts";

const result1 = pipe(O.some(1), O.map(n => n + 1)); // Some(2)
const result2 = pipe(O.none, O.map((n: number) => n + 1)); // None
function map<A, I>(fai: (a: A) => I): (ua: Option<A>) => Option<I>;
§
map<A, I>(fai: (a: A) => I): (ua: Option<A>) => Option<I>
[src]

§Type Parameters

§Parameters

§
fai: (a: A) => I
[src]

§Return Type

§
(ua: Option<A>) => Option<I>
[src]