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

apply

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

Apply a value A wrapped in an option to a function (a: A) => I wrapped in an Option. If either the wrapped value or the wrapped function are None then the result is None, if they are both Some then the result is Some.

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

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

§Type Parameters

§Parameters

§Return Type

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