Skip to main content
Module

x/fuzzy_octo_guacamole/mod.ts>Pattern.intersection

A playground for testing CI setup that deploys on Deno and NPM
Latest
function Pattern.intersection
import { Pattern } from "https://deno.land/x/fuzzy_octo_guacamole@v5.0.1/mod.ts";
const { intersection } = Pattern;

P.intersection(...patterns) returns a pattern which matches only if every patterns provided in parameter match the input.

Read the documentation for P.intersection on GitHub

Examples

match(value) .with( { user: P.intersection( { firstname: P.string }, { lastname: P.string }, { age: P.when(age => age > 21) } ) }, ({ user }) => 'will match { firstname: string, lastname: string, age: number } if age > 21' )

Type Parameters

input
ps extends readonly [Pattern<input>, ...Pattern<input>[]]

Parameters

...patterns: ps

Returns

Chainable<AndP<input, ps>>