UNPKG

pragmatic-fp-ts

Version:

Opinionated functional programming library with easy use in mind

15 lines (10 loc) 371 B
import { getValueOr } from "./main.ts"; // tests if both params are truthy export function and(a: boolean, b: boolean): boolean; export function and(a: boolean): (b: boolean) => boolean; export function and(a: boolean, b?: boolean) { if (arguments.length === 1) { return (_b: boolean) => and(a, _b); } return getValueOr(false, a) && getValueOr(false, b); }