Skip to main content
Module

x/fuzzy_octo_guacamole/mod.ts>Pattern.array

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

P.array(subpattern) takes a sub pattern and returns a pattern, which matches arrays if all their elements match the sub pattern.

Read the documentation for P.array on GitHub

Examples

match(value) .with({ users: P.array({ name: P.string }) }, () => 'will match { name: string }[]')

Returns

ArrayChainable<ArrayP<input, unknown>>

Type Parameters

input
p extends Pattern<WithDefault<UnwrapArray<input>, unknown>>

Parameters

pattern: p

Returns

ArrayChainable<ArrayP<input, p>>