import { array } from "https://deno.land/x/fun@v2.0.0/refinement.ts";
Turn a Refinement<unknown, A>
into Refinement<unknown, ReadonlyArray<A>>
.
Examples
Example 1
Example 1
import * as R from "./refinement.ts";
const numbers = R.array(R.number);
const result1 = numbers(null); // false
const result2 = numbers([]); // true, [] has type ReadonlyArray<number>
const result3 = numbers(["Hello"]); // false
const result4 = numbers([1]);
// true, variable has type ReadonlyArray<number>
Parameters
item: Refinement<unknown, A>
Returns
Refinement<unknown, ReadonlyArray<A>>