/** * The number module contains combinators for working with numbers. * * @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 { Comparable } from "./comparable.js"; import type { Initializable } from "./initializable.js"; import type { Showable } from "./showable.js"; /** * Compare two numbers and return true if they are equal. * * @example * ```ts * import * as N from "./number.ts"; * * const result1 = N.compare(1)(2); // false * const result2 = N.compare(1)(1); // true * ``` * * @since 2.0.0 */ export declare function compare(second: number): (first: number) => boolean; /** * Compare two numbers and return true if first is less than or equal to second. * * @example * ```ts * import * as N from "./number.ts"; * import { pipe } from "./fn.ts"; * * const result1 = pipe(1, N.lte(2)); // true * const result2 = pipe(1, N.lte(1)); // true * const result3 = pipe(2, N.lte(1)); // false * ``` * * @since 2.0.0 */ export declare function lte(second: number): (first: number) => boolean; /** * Multiply two numbers. * * @example * ```ts * import * as N from "./number.ts"; * import { pipe } from "./fn.ts"; * * const result = pipe(2, N.multiply(2)); // 4 * ``` * * @since 2.0.0 */ export declare function multiply(second: number): (first: number) => number; /** * Add two numbers. * * @example * ```ts * import * as N from "./number.ts"; * import { pipe } from "./fn.ts"; * * const result = pipe(2, N.add(2)); // 4 * ``` * * @since 2.0.0 */ export declare function add(second: number): (first: number) => number; /** * Return the positive modulus of two numbers. * * @example * ```ts * import * as N from "./number.ts"; * import { pipe } from "./fn.ts"; * * const result = pipe(11, N.mod(2)); // 1 * ``` * * @since 2.0.0 */ export declare function mod(second: number): (first: number) => number; /** * Return true if first evenly divides second. * * @example * ```ts * import * as N from "./number.ts"; * import { pipe } from "./fn.ts"; * * const result1 = pipe(2, N.divides(3)); // false * const result2 = pipe(2, N.divides(4)); // true * ``` * * @since 2.0.0 */ export declare function divides(second: number): (first: number) => boolean; /** * Compare two numbers and return their Ordering. 0 denotes equality, -1 denotes * that first is less than second, and 1 denotes that first is greater than * second. * * @example * ```ts * import * as N from "./number.ts"; * import { pipe } from "./fn.ts"; * * const result1 = N.compare(1)(1); // 0 * const result2 = N.compare(2)(1); // 1 * const result3 = N.compare(1)(2); // -1 * ``` * * @since 2.0.0 */ export declare function sort(first: number, second: number): Ordering; /** * A constant function that always returns 0. This is the additive identity and * is used as the init value for InitializableNumberSum. * * @example * ```ts * import * as N from "./number.ts"; * * const result = N.initZero(); // 0 * ``` * * @since 2.0.0 */ export declare function initZero(): number; /** * A constant function that always returns 1. This is the multiplicative identity and * is used as the init value for InitializableNumberProduct. * * @example * ```ts * import * as N from "./number.ts"; * * const result = N.initOne(); // 1 * ``` * * @since 2.0.0 */ export declare function initOne(): number; /** * A constant function that always returns Number.POSITIVE_INFINITY. * This is the minimum identity and is used as the init value for * InitializableNumberMinimum. * * @example * ```ts * import * as N from "./number.ts"; * * const result = N.initPosInf(); // Number.POSITIVE_INFINITY * ``` * * @since 2.0.0 */ export declare function initPosInf(): number; /** * A constant function that always returns Number.NEGATIVE_INFINITY. * This is the maximum identity and is used as the init value for * InitializableNumberMiximum. * * @example * ```ts * import * as N from "./number.ts"; * * const result = N.initNegInf(); // Number.NEGATIVE_INFINITY * ``` * * @since 2.0.0 */ export declare function initNegInf(): number; /** * The canonical implementation of Comparable for number. It contains * the method equal. * * @since 2.0.0 */ export declare const ComparableNumber: Comparable; /** * The canonical implementation of Sortable for number. It contains * the method compare. * * @since 2.0.0 */ export declare const SortableNumber: Sortable; /** * A Combinable instance for number that uses multiplication for combineenation. * It contains the method combine. * * @since 2.0.0 */ export declare const CombinableNumberProduct: Combinable; /** * A Combinable instance for number that uses addition for combineenation. * It contains the method combine. * * @since 2.0.0 */ export declare const CombinableNumberSum: Combinable; /** * A Combinable instance for number that uses Math.max for combineenation. * It contains the method combine. * * @since 2.0.0 */ export declare const CombinableNumberMax: Combinable; /** * A Combinable instance for number that uses Math.min for combineenation. * It contains the method combine. * * @since 2.0.0 */ export declare const CombinableNumberMin: Combinable; /** * A Initializable instance for number that uses multiplication for combineenation. * It contains the method combine. * * @since 2.0.0 */ export declare const InitializableNumberProduct: Initializable; /** * A Initializable instance for number that uses addition for combineenation. * It contains the method combine. * * @since 2.0.0 */ export declare const InitializableNumberSum: Initializable; /** * A Initializable instance for number that uses Math.max for combineenation. * It contains the method combine. * * @since 2.0.0 */ export declare const InitializableNumberMax: Initializable; /** * A Initializable instance for number that uses Math.min for combineenation. * It contains the method combine. * * @since 2.0.0 */ export declare const InitializableNumberMin: Initializable; /** * The canonical instance of Showable for number. It contains the method show. * * @since 2.0.0 */ export declare const ShowableNumber: Showable;