@cc-heart/utils
Version:
🔧 javascript common tools collection
116 lines (115 loc) • 3.76 kB
TypeScript
export declare const _toString: () => string;
/**
* Checks if the given value is an object.
*
* @param val - The value to be checked.
* @returns Returns true if the value is an object, otherwise false.
*/
export declare function isObject(val: unknown): val is object;
/**
* Checks if the given value is an symbol.
*
* @param val - The value to be checked.
* @returns Returns true if the value is an object, otherwise false.
*/
export declare function isSymbol(val: unknown): val is symbol;
/**
* Checks if the given value is a function.
*
* @param val - The value to be checked.
* @returns Returns true if the value is a function, false otherwise.
*/
export declare function isFn(val: unknown): val is Function;
/**
* Checks if the given value is a string.
*
* @param val - The value to be checked.
* @returns Returns true if the value is a string, false otherwise.
*/
export declare function isStr(val: unknown): val is string;
/**
* Checks if the provided value is a boolean.
*
* @param val - The value to check.
* @returns Returns true if the value is a boolean, false otherwise.
*/
export declare function isBool(val: unknown): val is boolean;
/**
* Checks if a value is undefined.
*
* @param val - The value to check.
* @returns Returns true if the value is undefined, otherwise false.
*/
export declare function isUndef(val: unknown): val is undefined;
/**
* Checks if the given value is null.
*
* @param val - The value to check.
* @returns Returns true if the value is null, false otherwise.
*/
export declare function isNull(val: unknown): val is null;
export declare const isNil: typeof isNull;
/**
* Determines whether a value is a primitive.
*
* @param val - The value to check.
* @returns Returns `true` if the value is a primitive, `false` otherwise.
*/
export declare function isPrimitive(val: unknown): boolean;
/**
* Checks if a value is falsy.
*
* @param val - The value to check.
* @returns Returns true if the value is falsy, otherwise false.
*/
export declare function isFalsy(val: unknown): val is false;
/**
* Checks if the given value is a number.
*
* @param val - The value to be checked.
* @returns Returns true if the value is a number, false otherwise.
*/
export declare function isNumber(val: unknown): val is number;
/**
* determines if it is a valid value other than NaN
* @param val
* @returns
*/
export declare function isEffectiveNumber(val: unknown): val is number;
/**
* Checks if a value is a Promise.
*
* @param val - The value to check.
* @returns Returns `true` if the value is a Promise, else `false`.
*/
export declare function isPromise(val: unknown): val is Promise<unknown>;
/**
* Checks if the given object has its own property.
*
* @param obj - The object to check.
* @param prop - The property to check.
* @returns Returns true if the object has its own property, otherwise false.
*/
export declare function hasOwn(obj: object, prop: PropertyKey): boolean;
/**
* An array is considered valid if it is an array and its length is greater than or equal to 0.
*
* @param arr - The array to be checked.
* @returns Returns true if the array is valid, false otherwise.
*/
export declare function isValidArray(arr: unknown[]): boolean;
/**
* Checks if a given value is a valid PropertyKey.
* A PropertyKey is a string, number, or symbol that can be used as a property name.
*
* @param val - The value to check.
* @returns True if the value is a PropertyKey, false otherwise.
*/
export declare function isPropertyKey(val: unknown): val is PropertyKey;
/**
* Checks if a given date is valid.
*
* @param date - The date to check.
* @returns True if the date is valid, false otherwise.
*/
export declare function isValidDate(date: Date): boolean;