UNPKG

codetrix

Version:

A lightweight lodash-style utility library

46 lines (45 loc) 1.52 kB
/** * Checks if a value is null or undefined. * @param value - The value to check. * @returns True if the value is null or undefined. */ export declare function isNil(value: any): boolean; /** * Returns one of two values based on a condition. * @param condition - Boolean condition to evaluate. * @param ifTrue - Value to return if condition is true. * @param ifFalse - Value to return if condition is false. * @returns The selected value. */ export declare function ifElse<T>(condition: boolean, ifTrue: T, ifFalse: T): T; /** * Checks if a value is a function. * @param value - The value to check. * @returns True if it's a function. */ export declare function isFunction(value: any): boolean; /** * Checks if a value is a plain object. * @param value - The value to check. * @returns True if it's a non-null object and not an array. */ export declare function isObject(value: any): boolean; /** * Checks if the given value is a boolean. * @param value - The value to check. * @returns True if it's a boolean. */ export declare function isBoolean(value: any): boolean; /** * Checks if a value is a Promise. * @param value - The value to check. * @returns True if it's a Promise. */ export declare function isPromise(value: any): boolean; /** * Creates a function that is invoked only once. * Useful for initialization logic. * @param fn - The function to wrap. * @returns A new function that runs only once. */ export declare function once<T extends (...args: any[]) => any>(fn: T): T;