import { refinement } from "https://deno.land/x/fun@v2.0.0/mod.ts";
const { isArrayN } = refinement;
Creates an instance Refinement<unknown, Array<unknown> & { length: N }>
where N is a number.
Examples
Example 1
Example 1
import * as R from "./refinement.ts";
const isTwoTuple = R.isArrayN(2);
const result1 = isTwoTuple(null); // false
const result2 = isTwoTuple([]); // false
const result3 = isTwoTuple([1, 2]);
// true, a variable is now typed as Array<unknown> & { length: 2 }
Parameters
n: N
Returns
Refinement<unknown, Array<unknown> & { length: N; }>