Skip to main content
Module

x/fuzzy_octo_guacamole/index.ts>match

A playground for testing CI setup that deploys on Deno and NPM
Latest
function match
import { match } from "https://deno.land/x/fuzzy_octo_guacamole@v5.0.1/index.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 the documentation for match on GitHub

Examples

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

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

Type Parameters

input
optional
output = symbols.unset