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

match

import { match } from "https://github.gh-proxy.cn/raw.githubusercontent.com/baetheus/fun/main/boolean.ts";

Create a match function over boolean

@example
import { match } from "./boolean.ts";
import * as O from "./option.ts";

const match1 = match(() => "Tina", () => "Turner");
const match2 = match(() => O.some("Hi"), () => O.none);

const result1 = match1(true); // "Tina"
const result2 = match1(false); // "Turner"
const result3 = match2(true); // Some("Hi")
const result4 = match2(false); // None
function match<A, B>(onTrue: () => A, onFalse: () => B): (a: boolean) => A | B;
§
match<A, B>(onTrue: () => A, onFalse: () => B): (a: boolean) => A | B
[src]

§Type Parameters

§Parameters

§
onTrue: () => A
[src]
§
onFalse: () => B
[src]

§Return Type

§
(a: boolean) => A | B
[src]