Skip to main content
Module

x/fuzzy_octo_guacamole/match.ts>match

A playground for testing CI setup that deploys on Deno and NPM
Go to Latest
variable match
import { match } from "https://deno.land/x/fuzzy_octo_guacamole@v2.0.0/match.ts";

match creates a pattern matching expression.

Use .with(pattern, handler) to pattern match on the input.

Use .exhaustive() or .otherwise(() => defaultValue) to end the expression and get the result.

Read match documentation on GitHub

Examples

declare let input: "A" | "B";

return match(input) .with("A", () => "It's a A!") .with("B", () => "It's a B!") .exhaustive();

type

<input, output = symbols.unset>(value: input) => Match<input, output>