Skip to main content
Module

x/fun/predicate.ts>getInitializableAny

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

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

Examples

Example 1

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

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

const lessThanZero = (n: number) => n < 0;
const greaterThanFifty = (n: number) => n > 50;

const notBetweenZeroAndFifty = pipe(
  lessThanZero,
  combine(greaterThanFifty),
);

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

Type Parameters

optional
A = never