Skip to main content
Module

x/fun/mod.ts>predicate.not

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

Negates the result of an existing Predicate.

Examples

Example 1

import { not } from "./predicate.ts";

const isPositive = (n: number) => n > 0;
const isZeroOrNegative = not(isPositive);

const result1 = isZeroOrNegative(1); // false
const result2 = isZeroOrNegative(0); // true
const result3 = isZeroOrNegative(-1); // true