Skip to main content
Module

x/fun/predicate.ts>or

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 or
import { or } from "https://deno.land/x/fun@v2.0.0-alpha.6/predicate.ts";

Creates the union of two predicates, returning true if either predicate returns true.

Examples

Example 1

import { or } from "./predicate.ts";
import { string, number } from "./refinement.ts";
import { pipe } from "./fn.ts";

// A Refinement is also a Predicate
const stringOrNumber = pipe(
  string,
  or(number),
);

const result1 = stringOrNumber("Hello"); // true
const result2 = stringOrNumber(1); // true
const result3 = stringOrNumber({}); // false