Skip to main content
Module

x/fuzzy_octo_guacamole/mod.ts>P.union

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

P.union(...patterns) returns a pattern which matches if at least one of the patterns provided in parameter match the input.

Read P.union documentation on GitHub

Examples

match(value) .with( { type: P.union('a', 'b', 'c') }, ({ user }) => 'will match { type: "a" | "b" | "c" }' )

Type Parameters

input
ps extends unknown extends input ? [UnknownPattern, ...UnknownPattern[]] : [Pattern<input>, ...Pattern<input>[]]

Parameters

...patterns: ps