Skip to main content
Module

x/fun/mod.ts>predicate.getInitializableAll

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Latest
function predicate.getInitializableAll
import { predicate } from "https://deno.land/x/fun@v2.0.0/mod.ts";
const { getInitializableAll } = predicate;

Get a Initializable<Predicate> for any type A that combines using the Predicate and function.

Examples

Example 1

import { getInitializableAll } from "./predicate.ts";
import { pipe } from "./fn.ts";

const { combine } = getInitializableAll<number>();

const greaterThanZero = (n: number) => n > 0;
const lessThanFifty = (n: number) => n < 50;

const betweenZeroAndFifty = pipe(
  greaterThanZero,
  combine(lessThanFifty)
);

const result1 = betweenZeroAndFifty(10); // true
const result2 = betweenZeroAndFifty(-10); // false
const result3 = betweenZeroAndFifty(100); // false

Type Parameters

optional
A = never

Returns

Initializable<Predicate<A>>