Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/fun/refinement.ts>array

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Latest
function array
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

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>>