/** * The boolean module contains combinators for working with boolean. * * @module number * @since 2.0.0 */ import "./_dnt.polyfills.js"; import type { Ordering, Sortable } from "./sortable.js"; import type { Combinable } from "./combinable.js"; import type { Initializable } from "./initializable.js"; import type { Comparable } from "./comparable.js"; import type { Showable } from "./showable.js"; /** * A function that always returns true. * * @example * ```ts * import { constTrue } from "./boolean.ts"; * * const result = constTrue(); // true * ``` * * @since 2.0.0 */ export declare const constTrue: () => boolean; /** * A function that always returns false. * * @example * ```ts * import { constFalse } from "./boolean.ts"; * * const result = constFalse(); // false * ``` * * @since 2.0.0 */ export declare const constFalse: () => boolean; /** * A type guard, indicating that a value is a boolean. * * @since 2.0.0 */ export declare function isBoolean(a: unknown): a is boolean; /** * Create a match function over boolean * * @example * ```ts * import { match } from "./boolean.ts"; * import * as O from "./option.ts"; * * const match1 = match(() => "Tina", () => "Turner"); * const match2 = match(() => O.some("Hi"), () => O.none); * * const result1 = match1(true); // "Tina" * const result2 = match1(false); // "Turner" * const result3 = match2(true); // Some("Hi") * const result4 = match2(false); // None * ``` * * @since 2.0.0 */ export declare function match(onTrue: () => A, onFalse: () => B): (a: boolean) => A | B; /** * Negate a given boolean. * * @example * ```ts * import { not } from "./boolean.ts"; * * const result1 = not(true); // false * const result2 = not(false); // true * ``` * * @since 2.0.0 */ export declare function not(ua: boolean): boolean; /** * Test the equality of two booleans. * * @example * ```ts * import { compare } from "./boolean.ts"; * * const result1 = compare(true)(false); // false * const result2 = compare(true)(true); // true * ``` * * @since 2.0.0 */ export declare function compare(second: boolean): (first: boolean) => boolean; /** * Compares two booleans, returning an Ordering. True is greater than * False in this ordering, generally, but the specifics are always * decided by the runtime. * * @example * ```ts * import { sort } from "./boolean.ts"; * * const result1 = sort(true, true); // 0 * const result2 = sort(true, false); // 1 * const result3 = sort(false, true); // -1 * ``` * * @since 2.0.0 */ export declare function sort(first: boolean, second: boolean): Ordering; /** * A curried form of logical Or. * * @example * ```ts * import { or } from "./boolean.ts"; * * const result1 = or(true)(true); // true * const result2 = or(true)(false); // true * const result3 = or(false)(false); // false * ``` * * @since 2.0.0 */ export declare function or(second: boolean): (first: boolean) => boolean; /** * A curried form of logical And. * * @example * ```ts * import { and } from "./boolean.ts"; * * const result1 = and(true)(true); // true * const result2 = and(true)(false); // false * const result3 = and(false)(false); // false * ``` * * @since 2.0.0 */ export declare function and(second: boolean): (first: boolean) => boolean; /** * The canonical implementation of Sortable for boolean. It contains * the method lt, lte, equals, gte, gt, min, max, clamp, between, * and compare. * * @since 2.0.0 */ export declare const SortableBoolean: Sortable; /** * The canonical implementation of Comparable for boolean. It contains * the method equals. * * @since 2.0.0 */ export declare const ComparableBoolean: Comparable; /** * The canonical implementation of Combinable for boolean that * combines using the logical and operator. It contains the * method combine. * * @since 2.0.0 */ export declare const CombinableBooleanAll: Combinable; /** * The canonical implementation of Combinable for boolean that * combines using the logical or operator. It contains the * method combine. * * @since 2.0.0 */ export declare const CombinableBooleanAny: Combinable; /** * The canonical implementation of Initializable for boolean that * combines using the logical and operator. It contains the * method combine. * * @since 2.0.0 */ export declare const InitializableBooleanAll: Initializable; /** * The canonical implementation of Initializable for boolean that * combines using the logical or operator. It contains the * method combine. * * @since 2.0.0 */ export declare const InitializableBooleanAny: Initializable; /** * The canoncial implementation of Showable for boolean. It * uses JSON.stringify to turn a boolean into a string. * It contains the method show. */ export declare const ShowableBoolean: Showable;