booleanlab
Version:
A comprehensive TypeScript utility library for advanced boolean operations. Simplify your boolean logic with easy-to-use functions.
113 lines (112 loc) • 3.49 kB
TypeScript
/**
* Return `true` for truthy values
* @returns {boolean}
*/
export declare function trueValue(): boolean;
/**
* Return `false` for truthy values
* @returns {boolean}
*/
export declare function falseValue(): boolean;
/**
* Return `true` if both booleans are equal and `false` otherwise
* @param {a: boolean, b: boolean}
* @returns {boolean}
*/
export declare function isEqual(a: boolean, b: boolean): boolean;
/**
* Return `true` if both booleans are not equal and `false` otherwise
* @param {a: boolean, b: boolean}
* @returns {boolean}
*/
export declare function isNotEqual(a: boolean, b: boolean): boolean;
/**
* Return the result of a logical AND operation between two booleans
* @param {a: boolean, b: boolean}
* @returns {boolean}
*/
export declare function andOperation(a: boolean, b: boolean): boolean;
/**
* Return the result of a logical OR operation between two booleans
* @param {a: boolean, b: boolean}
* @returns {boolean}
*/
export declare function orOperation(a: boolean, b: boolean): boolean;
/**
* Return the result of a logical XOR (exclusive OR) operation between two booleans
* @param {a: boolean, b: boolean}
* @returns {boolean}
*/
export declare function xorOperation(a: boolean, b: boolean): boolean;
/**
* Return the negation (inverse) of the boolean value
* @param {a: boolean}
* @returns {boolean}
*/
export declare function negate(a: boolean): boolean;
/**
* Check if a boolean value is exactly `true`
* @param {a: boolean}
* @returns {boolean}
*/
export declare function isTrue(a: boolean): boolean;
/**
* Check if a boolean value is exactly `false`
* @param {a: boolean}
* @returns {boolean}
*/
export declare function isFalse(a: boolean): boolean;
/**
* Convert a boolean to binary (1 for true, 0 for false)
* @param {a: boolean}
* @returns {number}
*/
export declare function toBinary(a: boolean): number;
/**
* Convert any value to a boolean (falsey values become false, others become true)
* @param {a: any}
* @returns {boolean}
*/
export declare function toBoolean(a: any): boolean;
/**
* Return the result of a logical NAND operation (NOT AND) between two booleans
* @param {a: boolean, b: boolean}
* @returns {boolean}
*/
export declare function nandOperation(a: boolean, b: boolean): boolean;
/**
* Return the result of a logical NOR operation (NOT OR) between two booleans
* @param {a: boolean, b: boolean}
* @returns {boolean}
*/
export declare function norOperation(a: boolean, b: boolean): boolean;
/**
* Convert a boolean value to a string representation ("True" or "False")
* @param {value: boolean}
* @returns {string}
*/
export declare const toString: (value: boolean) => string;
/**
* Check if a value is truthy (not null, undefined, false, 0, NaN, or '')
* @param {value: any}
* @returns {boolean}
*/
export declare function isTruthy(value: any): boolean;
/**
* Check if a value is falsy (null, undefined, false, 0, NaN, '')
* @param {value: any}
* @returns {boolean}
*/
export declare function isFalsy(value: any): boolean;
/**
* Return the result of a logical Implication (A → B) operation between two booleans
* @param {a: boolean, b: boolean}
* @returns {boolean}
*/
export declare function implication(a: boolean, b: boolean): boolean;
/**
* Return the result of a logical Biconditional (A ↔ B) operation between two booleans
* @param {a: boolean, b: boolean}
* @returns {boolean}
*/
export declare function biConditional(a: boolean, b: boolean): boolean;