@megaorm/test
Version:
This package is designed to assist developers in type checking and validation for various JavaScript values. It provides a collection of type-checking functions, and utilities to validate your values.
1,244 lines (1,243 loc) • 36.4 kB
TypeScript
/**
* Checks if a value is an instance of `Set`.
*
* @param value The value to check.
* @returns `true` if the value is a `Set`; otherwise, `false`.
*
* @example
* // Instance of Set
* console.log(isSet(new Set())); // true
*
* // Not a Set (Array type)
* console.log(isSet([])); // false
*/
export declare function isSet(value: any): boolean;
/**
* Checks if a value is an instance of `Map`.
*
* @param value The value to check.
* @returns `true` if the value is a `Map`; otherwise, `false`.
*
* @example
* // Instance of Map
* console.log(isMap(new Map())); // true
*
* // Not a Map (Object type)
* console.log(isMap({})); // false
*/
export declare function isMap(value: any): boolean;
/**
* Checks if a value is an instance of `WeakSet`.
*
* @param value The value to check.
* @returns `true` if the value is a `WeakSet`; otherwise, `false`.
*
* @example
* // Instance of WeakSet
* console.log(isWeakSet(new WeakSet())); // true
*
* // Not a WeakSet (Set type)
* console.log(isWeakSet(new Set())); // false
*/
export declare function isWeakSet(value: any): boolean;
/**
* Checks if a value is an instance of `WeakMap`.
*
* @param value The value to check.
* @returns `true` if the value is a `WeakMap`; otherwise, `false`.
*
* @example
* // Instance of WeakMap
* console.log(isWeakMap(new WeakMap())); // true
*
* // Not a WeakMap (Map type)
* console.log(isWeakMap(new Map())); // false
*/
export declare function isWeakMap(value: any): boolean;
/**
* Checks if a value is an array.
*
* @param value The value to check.
* @returns `true` if the value is an array; otherwise, `false`.
*
* @example
* // Array type
* console.log(isArr([])); // true
*
* // Not an array (Object type)
* console.log(isArr({})); // false
*/
export declare function isArr(value: any): boolean;
/**
* Checks if a value is a non-null object (excluding arrays).
*
* @param value The value to check.
* @returns `true` if the value is a non-null object; otherwise, `false`.
*
* @example
* // Object type
* console.log(isObj({})); // true
*
* // Not an object (Array type)
* console.log(isObj([])); // false
*
* // Not an object (null)
* console.log(isObj(null)); // false
*/
export declare function isObj(value: any): boolean;
/**
* Checks if a value is a number.
*
* @param value The value to check.
* @returns `true` if the value is a number; otherwise, `false`.
*
* @example
* // Number type
* console.log(isNum(42)); // true
*
* // Not a number (String type)
* console.log(isNum('42')); // false
*/
export declare function isNum(value: any): boolean;
/**
* Checks if a value is a string.
*
* @param value The value to check.
* @returns `true` if the value is a string; otherwise, `false`.
*
* @example
* // String type
* console.log(isTxt('hello')); // true
*
* // Not a string (Number type)
* console.log(isTxt(42)); // false
*/
export declare function isTxt(value: any): boolean;
/**
* Alias for `isTxt`. Checks if a value is a string.
*
* @param value The value to check.
* @returns `true` if the value is a string; otherwise, `false`.
*
* @example
* // String type
* console.log(isStr('hello')); // true
*
* // Not a string (Number type)
* console.log(isStr(42)); // false
*/
export declare function isStr(value: any): boolean;
/**
* Checks if a value is a boolean.
*
* @param value The value to check.
* @returns `true` if the value is a boolean; otherwise, `false`.
*
* @example
* // Boolean type
* console.log(isBool(true)); // true
*
* // Not a boolean (String type)
* console.log(isBool('true')); // false
*/
export declare function isBool(value: any): boolean;
/**
* Checks if a value is a function.
*
* @param value The value to check.
* @returns `true` if the value is a function; otherwise, `false`.
*
* @example
* // Function type
* console.log(isFunc(() => {})); // true
*
* // Not a function (Object type)
* console.log(isFunc({})); // false
*/
export declare function isFunc(value: any): boolean;
/**
* Checks if a value is a symbol.
*
* @param value The value to check.
* @returns `true` if the value is a symbol; otherwise, `false`.
*
* @example
* // Symbol type
* console.log(isSymbol(Symbol())); // true
*
* // Not a symbol (String type)
* console.log(isSymbol('symbol')); // false
*/
export declare function isSymbol(value: any): boolean;
/**
* Checks if a value is an integer.
*
* @param value The value to check.
* @returns `true` if the value is an integer; otherwise, `false`.
*
* @example
* // Integer type
* console.log(isInt(42)); // true
*
* // Not an integer (Float type)
* console.log(isInt(42.42)); // false
*/
export declare function isInt(value: any): boolean;
/**
* Checks if a value is a floating-point number.
*
* @param value The value to check.
* @returns `true` if the value is a float; otherwise, `false`.
*
* @example
* // Float type
* console.log(isFloat(42.42)); // true
*
* // Not a float (Integer type)
* console.log(isFloat(42)); // false
*/
export declare function isFloat(value: any): boolean;
/**
* Checks if a value is NaN (Not a Number).
*
* @param value The value to check.
* @returns `true` if the value is NaN; otherwise, `false`.
*
* @example
* // NaN value
* console.log(isNan(NaN)); // true
*
* // Not NaN (Number type)
* console.log(isNan(42)); // false
*/
export declare function isNan(value: any): boolean;
/**
* Checks if a value is null.
*
* @param value The value to check.
* @returns `true` if the value is null; otherwise, `false`.
*
* @example
* // Null value
* console.log(isNull(null)); // true
*
* // Not null (Undefined)
* console.log(isNull(undefined)); // false
*/
export declare function isNull(value: any): boolean;
/**
* Checks if a value is undefined.
*
* @param value The value to check.
* @returns `true` if the value is undefined; otherwise, `false`.
*
* @example
* // Undefined value
* console.log(isUndefined(undefined)); // true
*
* // Not undefined (Null value)
* console.log(isUndefined(null)); // false
*/
export declare function isUndefined(value: any): boolean;
/**
* Checks if a value is defined (not undefined).
*
* @param value The value to check.
* @returns `true` if the value is defined; otherwise, `false`.
*
* @example
* // Defined value
* console.log(isDefined(42)); // true
*
* // Undefined value
* console.log(isDefined(undefined)); // false
*/
export declare function isDefined(value: any): boolean;
/**
* Strictly checks if a value is defined (not null, undefined, or NaN).
*
* @param value The value to check.
* @returns `true` if the value is strictly defined; otherwise, `false`.
*
* @example
* // Defined value
* console.log(isDefinedStrict(42)); // true
*
* // Null value
* console.log(isDefinedStrict(null)); // false
*
* // NaN value
* console.log(isDefinedStrict(NaN)); // false
*
* // Undefined value
* console.log(isDefinedStrict(undefined)); // false
*/
export declare function isDefinedStrict(value: any): boolean;
/**
* Checks if a value is Infinity.
*
* @param value The value to check.
* @returns `true` if the value is Infinity; otherwise, `false`.
*
* @example
* // Infinity value
* console.log(isInf(Infinity)); // true
*
* // Not Infinity (Number type)
* console.log(isInf(42)); // false
*/
export declare function isInf(value: any): boolean;
/**
* Checks if a value is a finite number.
*
* @param value The value to check.
* @returns `true` if the value is finite; otherwise, `false`.
*
* @example
* // Finite number
* console.log(isFinite(42)); // true
*
* // Infinite number
* console.log(isFinite(Infinity)); // false
*
* // NaN value
* console.log(isFinite(NaN)); // false
*/
export declare function isFinite(value: any): boolean;
/**
* Checks if a value is truthy (not falsy).
*
* @param value The value to check.
* @returns `true` if the value is truthy; otherwise, `false`.
*
* @example
* // Truthy value
* console.log(isTruthy(1)); // true
*
* // Falsy value
* console.log(isTruthy(0)); // false
*/
export declare function isTruthy(value: any): boolean;
/**
* Checks if a value is falsy (i.e., false, 0, "", null, undefined, or NaN).
*
* @param value The value to check.
* @returns `true` if the value is falsy; otherwise, `false`.
*
* @example
* // Falsy value
* console.log(isFalsy(0)); // true
*
* // Truthy value
* console.log(isFalsy(1)); // false
*/
export declare function isFalsy(value: any): boolean;
/**
* Checks if a value is strictly `false`.
*
* @param value The value to check.
* @returns `true` if the value is strictly `false`; otherwise, `false`.
*
* @example
* // False value
* console.log(isFalse(false)); // true
*
* // Not false (Boolean value)
* console.log(isFalse(true)); // false
*/
export declare function isFalse(value: any): boolean;
/**
* Checks if a value is strictly `true`.
*
* @param value The value to check.
* @returns `true` if the value is strictly `true`; otherwise, `false`.
*
* @example
* // True value
* console.log(isTrue(true)); // true
*
* // Not true (Boolean value)
* console.log(isTrue(false)); // false
*/
export declare function isTrue(value: any): boolean;
/**
* Checks if a value is iterable (i.e., has an `Symbol.iterator` property).
*
* @param value The value to check.
* @returns `true` if the value is iterable; otherwise, `false`.
*
* @example
* // Iterable (Array)
* console.log(isIterable([1, 2, 3])); // true
*
* // Not iterable (Number type)
* console.log(isIterable(42)); // false
*/
export declare function isIterable(value: any): boolean;
/**
* Checks if a number is even.
*
* @param value The value to check.
* @returns `true` if the number is even; otherwise, `false`.
*
* @example
* // Even number
* console.log(isEven(42)); // true
*
* // Odd number
* console.log(isEven(43)); // false
*/
export declare function isEven(value: any): boolean;
/**
* Checks if a number is odd.
*
* @param value The value to check.
* @returns `true` if the number is odd; otherwise, `false`.
*
* @example
* // Odd number
* console.log(isOdd(43)); // true
*
* // Even number
* console.log(isOdd(42)); // false
*/
export declare function isOdd(value: any): boolean;
/**
* Checks if a string is in camelCase format.
*
* @param value The value to check.
* @returns `true` if the string is camelCase; otherwise, `false`.
*
* @example
* // camelCase format
* console.log(isCamelCase('camelCase')); // true
*
* // Not camelCase (Snake case)
* console.log(isCamelCase('snake_case')); // false
*/
export declare function isCamelCase(value: any): boolean;
/**
* Checks if a string is in PascalCase format.
*
* @param value The value to check.
* @returns `true` if the string is PascalCase; otherwise, `false`.
*
* @example
* // PascalCase format
* console.log(isPascalCase('PascalCase')); // true
*
* // Not PascalCase (camelCase)
* console.log(isPascalCase('pascalCase')); // false
*/
export declare function isPascalCase(value: any): boolean;
/**
* Checks if a string is in snake_case format.
*
* @param value The value to check.
* @returns `true` if the string is snake_case; otherwise, `false`.
*
* @example
* // snake_case format
* console.log(isSnakeCase('snake_case')); // true
*
* // Not snake_case (camelCase)
* console.log(isSnakeCase('snakeCase')); // false
*/
export declare function isSnakeCase(value: any): boolean;
/**
* Checks if a string is in kebab-case format.
*
* @param value The value to check.
* @returns `true` if the string is kebab-case; otherwise, `false`.
*
* @example
* // kebab-case format
* console.log(iskababCase('kebab-case')); // true
*
* // Not kebab-case (camelCase)
* console.log(iskababCase('kebabCase')); // false
*/
export declare function iskababCase(value: any): boolean;
/**
* Checks if a value is an instance of the `Error` object.
*
* @param value The value to check.
* @returns `true` if the value is an `Error` object; otherwise, `false`.
*
* @example
* // Error object
* console.log(isError(new Error())); // true
*
* // Not an Error object (String)
* console.log(isError('Error')); // false
*/
export declare function isError(value: any): boolean;
/**
* Checks if an object is a child of the given class (instanceof).
*
* @param child The child object.
* @param parent The parent class.
* @returns `true` if `c` is a child of `p`; otherwise, `false`.
*
* @example
* class Parent {} // Parent class
* const child = new Parent(); // child object
*
* // child instanceof Parent
* console.log(isChildOf(child, Parent)); // true
*
* // {} instanceof Parent
* console.log(isChildOf({}, Parent)); // false
*/
export declare function isChildOf(child: any, parent: any): boolean;
/**
* Checks if a value is a class (constructor function).
*
* @param value The value to check.
* @returns `true` if the value is a class; otherwise, `false`.
*
* @example
* // Class (constructor function)
* console.log(isClass(class MyClass {})); // true
*
* // Not a class (Function)
* console.log(isClass(function myFunc() {})); // false
*/
export declare function isClass(value: any): boolean;
/**
* Checks if a class is a subclass of another class.
*
* @param child The child class.
* @param parent The parent class.
* @returns `true` if `child` is a subclass of `parent`; otherwise, `false`.
*
* @example
* class Parent {} // Parent class
* class Child extends Parent {} // Child class
*
* // Child class is a subclass of Parent class (child extends parent)
* console.log(isSubclass(Child, Parent)); // true
*
* // Parent class is a subclass of Child class (parent extends child)
* console.log(isSubclass(Parent, Child)); // false
*/
export declare function isSubclass(child: any, parent: any): boolean;
/**
* Checks if a value is a valid `Date` object.
*
* @param value The value to check.
* @returns `true` if the value is a `Date` object; otherwise, `false`.
*
* @example
* // Date object
* console.log(isDate(new Date())); // true
*
* // Not a Date object (String)
* console.log(isDate('2021-01-01')); // false
*/
export declare function isDate(value: any): boolean;
/**
* Checks if a value is a valid `RegExp` (Regular Expression).
*
* @param value The value to check.
* @returns `true` if the value is a `RegExp` object; otherwise, `false`.
*
* @example
* // Regular Expression object
* console.log(isRegex(/abc/)); // true
*
* // Not a Regular Expression object (String)
* console.log(isRegex('abc')); // false
*/
export declare function isRegex(value: any): boolean;
/**
* Checks if a value is a Promise.
*
* @param value The value to check.
* @returns `true` if the value is a Promise; otherwise, `false`.
*
* @example
* // Promise object
* console.log(isPromise(Promise.resolve())); // true
*
* // Not a Promise (Function)
* console.log(isPromise(function() {})); // false
*/
export declare function isPromise(value: any): boolean;
/**
* Checks if an object is non-empty (has at least one property).
*
* @param value The value to check.
* @returns `true` if the object is non-empty; otherwise, `false`.
*
* @example
* // Non-empty object
* console.log(isFullObj({ key: 'value' })); // true
*
* // Empty object
* console.log(isFullObj({})); // false
*/
export declare function isFullObj(value: any): boolean;
/**
* Checks if an array is non-empty (has at least one element).
*
* @param value The value to check.
* @returns `true` if the array is non-empty; otherwise, `false`.
*
* @example
* // Non-empty array
* console.log(isFullArr([1, 2, 3])); // true
*
* // Empty array
* console.log(isFullArr([])); // false
*/
export declare function isFullArr(value: any): boolean;
/**
* Checks if a string is non-empty (contains at least one non-whitespace character).
*
* @param value The value to check.
* @returns `true` if the string is non-empty; otherwise, `false`.
*
* @example
* // Non-empty string
* console.log(isFullStr('Hello')); // true
*
* // Empty string
* console.log(isFullStr(' ')); // false
*/
export declare function isFullStr(value: any): boolean;
/**
* Checks if an object is empty (has no properties).
*
* @param value The value to check.
* @returns `true` if the object is empty; otherwise, `false`.
*
* @example
* // Empty object
* console.log(isEmptyObj({})); // true
*
* // Non-empty object
* console.log(isEmptyObj({ key: 'value' })); // false
*/
export declare function isEmptyObj(value: any): boolean;
/**
* Checks if an array is empty (contains no elements).
*
* @param value The value to check.
* @returns `true` if the array is empty; otherwise, `false`.
*
* @example
* // Empty array
* console.log(isEmptyArr([])); // true
*
* // Non-empty array
* console.log(isEmptyArr([1])); // false
*/
export declare function isEmptyArr(value: any): boolean;
/**
* Checks if a string is empty (contains non-whitespace characters).
*
* @param value The value to check.
* @returns `true` if the string is empty; otherwise, `false`.
*
* @example
* // Empty string
* console.log(isEmptyStr('')); // true
* console.log(isEmptyStr(' ')); // true
* console.log(isEmptyStr('\s\s\s')); // true
*
* // Non-empty string
* console.log(isEmptyStr('Hello')); // false
*/
export declare function isEmptyStr(value: any): boolean;
/**
* Checks if an array is non-empty and contains only numbers.
*
* @param value The value to check.
* @returns `true` if the array contains only numbers; otherwise, `false`.
*
* @example
* // Array of numbers
* console.log(isArrOfNum([1, 2, 3.3])); // true
*
* // Array containing non-number values
* console.log(isArrOfNum([1, 'two', 3.3])); // false
*/
export declare function isArrOfNum(value: any): boolean;
/**
* Checks if an array is non-empty and contains only integers.
*
* @param value The value to check.
* @returns `true` if the array contains only integers; otherwise, `false`.
*
* @example
* // Array of integers
* console.log(isArrOfInt([1, 2, 3])); // true
*
* // Array containing non-integer values
* console.log(isArrOfInt([1, 2.5, 3])); // false
*/
export declare function isArrOfInt(value: any): boolean;
/**
* Checks if an array is non-empty and contains only floating-point numbers.
*
* @param value The value to check.
* @returns `true` if the array contains only floating-point numbers; otherwise, `false`.
*
* @example
* // Array of floats
* console.log(isArrOfFloat([1.5, 2.7, 3.2])); // true
*
* // Array containing non-float values
* console.log(isArrOfFloat([1, 2.5, '3'])); // false
*/
export declare function isArrOfFloat(value: any): boolean;
/**
* Checks if an array is non-empty and contains only strings.
*
* @param value The value to check.
* @returns `true` if the array contains only strings; otherwise, `false`.
*
* @example
* // Array of strings
* console.log(isArrOfStr(['hello', 'world'])); // true
*
* // Array containing non-string values
* console.log(isArrOfStr(['hello', 123])); // false
*/
export declare function isArrOfStr(value: any): boolean;
/**
* Checks if an array is non-empty and contains only arrays.
*
* @param value The value to check.
* @returns `true` if the array contains only arrays; otherwise, `false`.
*
* @example
* // Array of arrays
* console.log(isArrOfArr([[], []])); // true
*
* // Array containing non-array values
* console.log(isArrOfArr([[], 'two'])); // false
*/
export declare function isArrOfArr(value: any): boolean;
/**
* Checks if an array is non-empty and contains only objects.
*
* @param value The value to check.
* @returns `true` if the array contains only objects; otherwise, `false`.
*
* @example
* // Array of objects
* console.log(isArrOfObj([{}, {}])); // true
*
* // Array containing non-object values
* console.log(isArrOfObj([{}, 1])); // false
*/
export declare function isArrOfObj(value: any): boolean;
/**
* Checks if an array is non-empty and contains only functions.
*
* @param value The value to check.
* @returns `true` if the array contains only functions; otherwise, `false`.
*
* @example
* // Array of functions
* console.log(isArrOfFunc([() => {}, () => {}])); // true
*
* // Array containing non-function values
* console.log(isArrOfFunc([() => {}, 'string'])); // false
*/
export declare function isArrOfFunc(value: any): boolean;
/**
* Checks if an array is non-empty and contains only booleans.
*
* @param value The value to check.
* @returns `true` if the array contains only booleans; otherwise, `false`.
*
* @example
* // Array of booleans
* console.log(isArrOfBool([true, false, true])); // true
*
* // Array containing non-boolean values
* console.log(isArrOfBool([true, 'false'])); // false
*/
export declare function isArrOfBool(value: any): boolean;
/**
* Checks if an array is non-empty and allows any type of value (no type restriction).
*
* @param value The value to check.
* @returns `true` if the array is non-empty; otherwise, `false`.
*
* @example
* // Any array (of any type of values)
* console.log(isArrOfAny([1, 'string', true])); // true
*
* // Empty array
* console.log(isArrOfAny([])); // false
*/
export declare function isArrOfAny(value: any): boolean;
/**
* Checks if an object is non-empty and contains only numeric values.
*
* @param value The value to check.
* @returns `true` if the object contains only numbers; otherwise, `false`.
*
* @example
* // Object with numeric values
* console.log(isObjOfNum({a: 1, b: 2.2})); // true
*
* // Object containing non-numeric values
* console.log(isObjOfNum({a: 1, b: 'two'})); // false
*/
export declare function isObjOfNum(value: any): boolean;
/**
* Checks if an object is non-empty and contains only integer values.
*
* @param value The value to check.
* @returns `true` if the object contains only integers; otherwise, `false`.
*
* @example
* // Object with integer values
* console.log(isObjOfInt({a: 1, b: 2})); // true
*
* // Object containing non-integer values
* console.log(isObjOfInt({a: 1, b: 2.5})); // false
*/
export declare function isObjOfInt(value: any): boolean;
/**
* Checks if an object is non-empty and contains only floating-point values.
*
* @param value The value to check.
* @returns `true` if the object contains only floats; otherwise, `false`.
*
* @example
* // Object with floating-point values
* console.log(isObjOfFloat({a: 1.1, b: 2.5})); // true
*
* // Object containing non-float values
* console.log(isObjOfFloat({a: 1, b: '2.5'})); // false
*/
export declare function isObjOfFloat(value: any): boolean;
/**
* Checks if an object is non-empty and contains only string values.
*
* @param value The value to check.
* @returns `true` if the object contains only strings; otherwise, `false`.
*
* @example
* // Object with string values
* console.log(isObjOfStr({a: 'apple', b: 'banana'})); // true
*
* // Object containing non-string values
* console.log(isObjOfStr({a: 'apple', b: 123})); // false
*/
export declare function isObjOfStr(value: any): boolean;
/**
* Checks if an object is non-empty and contains only arrays as values.
*
* @param value The value to check.
* @returns `true` if the object contains only arrays as values; otherwise, `false`.
*
* @example
* // Object with array values
* console.log(isObjOfArr({a: [1, 2], b: [3, 4]})); // true
*
* // Object containing non-array values
* console.log(isObjOfArr({a: [1, 2], b: 'string'})); // false
*/
export declare function isObjOfArr(value: any): boolean;
/**
* Checks if an object is non-empty and contains only objects as values.
*
* @param value The value to check.
* @returns `true` if the object contains only objects as values; otherwise, `false`.
*
* @example
* // Object with object values
* console.log(isObjOfObj({a: {x: 1}, b: {y: 2}})); // true
*
* // Object containing non-object values
* console.log(isObjOfObj({a: {x: 1}, b: 'string'})); // false
*/
export declare function isObjOfObj(value: any): boolean;
/**
* Checks if an object is non-empty and contains only functions as values.
*
* @param value The value to check.
* @returns `true` if the object contains only functions as values; otherwise, `false`.
*
* @example
* // Object with function values
* console.log(isObjOfFunc({a: () => {}, b: () => {}})); // true
*
* // Object containing non-function values
* console.log(isObjOfFunc({a: () => {}, b: 'string'})); // false
*/
export declare function isObjOfFunc(value: any): boolean;
/**
* Checks if an object is non-empty and contains only boolean values.
*
* @param value The value to check.
* @returns `true` if the object contains only booleans as values; otherwise, `false`.
*
* @example
* // Object with boolean values
* console.log(isObjOfBool({a: true, b: false})); // true
*
* // Object containing non-boolean values
* console.log(isObjOfBool({a: true, b: 'false'})); // false
*/
export declare function isObjOfBool(value: any): boolean;
/**
* Checks if an object is non-empty and allows any type of value (no type restriction).
*
* @param value The value to check.
* @returns `true` if the object is non-empty; otherwise, `false`.
*
* @example
* // Object with any type of values
* console.log(isObjOfAny({a: 1, b: 'string'})); // true
*
* // Empty object
* console.log(isObjOfAny({})); // false
*/
export declare function isObjOfAny(value: any): boolean;
/**
* Checks if a string is in ISO 8601 format (e.g., "2024-11-28T12:30:00.000Z").
*
* @param value The value to check.
* @returns `true` if the string matches the ISO 8601 format; otherwise, `false`.
*
* @example
* // Valid ISO date
* console.log(isIso('2024-11-28T12:30:00.000Z')); // true
*
* // Invalid ISO date
* console.log(isIso('2024-11-28')); // false
*/
export declare function isIso(value: any): boolean;
/**
* Checks if a string is in the datetime format (e.g., "2024-11-28 12:30:00").
*
* @param value The value to check.
* @returns `true` if the string matches the datetime format; otherwise, `false`.
*
* @example
* // Valid datetime string
* console.log(isDateTime('2024-11-28 12:30:00')); // true
*
* // Invalid datetime string
* console.log(isDateTime('2024-11-28')); // false
*/
export declare function isDateTime(value: any): boolean;
/**
* Checks if a string is in the date format (e.g., "2024-11-28").
*
* @param date The value to check.
* @returns `true` if the string matches the date format; otherwise, `false`.
*
* @example
* // Valid date string
* console.log(isDateStr('2024-11-28')); // true
*
* // Invalid date string
* console.log(isDateStr('2024-11-28 12:30:00')); // false
*/
export declare function isDateExp(date: any): boolean;
/**
* Checks if a string is in the time format (e.g., "12:30:00").
*
* @param date The value to check.
* @returns `true` if the string matches the time format; otherwise, `false`.
*
* @example
* // Valid time string
* console.log(isTimeStr('12:30:00')); // true
*
* // Invalid time string
* console.log(isTimeStr('12:30')); // false
*/
export declare function isTimeExp(date: any): boolean;
/**
* Checks if a string is a valid property name (e.g., a valid JavaScript variable name).
*
* @param value The value to check.
* @returns `true` if the string matches the property name pattern; otherwise, `false`.
*
* @example
* // Valid property name
* console.log(isPropExp('myVar')); // true
*
* // Invalid property name
* console.log(isPropExp('123var')); // false
*/
export declare function isPropExp(value: any): boolean;
/**
* Checks if a string is a valid number (including integers and floats).
*
* @param value The value to check.
* @returns `true` if the string is a valid number; otherwise, `false`.
*
* @example
* // Valid number
* console.log(isNumExp('123')); // true
* console.log(isNumExp('123.45')); // true
*
* // Invalid number
* console.log(isNumExp('abc')); // false
*/
export declare function isNumExp(value: any): boolean;
/**
* Checks if a string is a valid integer.
*
* @param value The value to check.
* @returns `true` if the string is a valid integer; otherwise, `false`.
*
* @example
* // Valid integer
* console.log(isIntExp('123')); // true
*
* // Invalid integer
* console.log(isIntExp('123.45')); // false
*/
export declare function isIntExp(value: any): boolean;
/**
* Checks if a string is a valid float (decimal number).
*
* @param value The value to check.
* @returns `true` if the string is a valid float; otherwise, `false`.
*
* @example
* // Valid float
* console.log(isFloatExp('123.45')); // true
*
* // Invalid float
* console.log(isFloatExp('123')); // false
*/
export declare function isFloatExp(value: any): boolean;
/**
* Checks if a string is a valid string literal (single or double-quoted).
*
* @param value The value to check.
* @returns `true` if the string is a valid string literal; otherwise, `false`.
*
* @example
* // Valid string literal
* console.log(isStrExp("'hello'")); // true
* console.log(isStrExp('"world"')); // true
*
* // Invalid string literal
* console.log(isStrExp('hello')); // false
*/
export declare function isStrExp(value: any): boolean;
/**
* Checks if a string is a valid dot notation expression for property access.
*
* @param value The value to check.
* @returns `true` if the string is a valid dot notation expression; otherwise, `false`.
*
* @example
* // Valid dot notation expression
* console.log(isDotExp('object.property')); // true
*
* // Invalid dot notation expression
* console.log(isDotExp('object.123property')); // false
*/
export declare function isDotExp(value: any): boolean;
/**
* Checks if a string is a valid bracket notation expression for property access.
*
* @param value The value to check.
* @returns `true` if the string is a valid bracket notation expression; otherwise, `false`.
*
* @example
* // Valid bracket notation expression
* console.log(isBracketExp('object["property"]')); // true
*
* // Invalid bracket notation expression
* console.log(isBracketExp('object["123"]')); // false
*/
export declare function isBracketExp(value: any): boolean;
/**
* Checks if a string is a valid combination of dot and bracket notations.
*
* @param value The value to check.
* @returns `true` if the string is a valid combination of dot and bracket notations; otherwise, `false`.
*
* @example
* // Valid combination of dot and bracket notations
* console.log(isAnyExp('object.property[0]')); // true
* console.log(isAnyExp('object.property["key"]')); // true
*
* // Invalid combination of dot and bracket notations
* console.log(isAnyExp('object.123property[0]')); // false
*/
export declare function isAnyExp(value: any): boolean;
/**
* Checks if an object has a specific property.
*
* @param object The object to check.
* @param property The property to check for.
* @returns `true` if the object has the specified property; otherwise, `false`.
*
* @example
* // Object with the property
* console.log(hasProp({a: 1, b: 2}, 'a')); // true
*
* // Object without the property
* console.log(hasProp({a: 1, b: 2}, 'c')); // false
*/
export declare function hasProp(object: any, property: any): boolean;
/**
* Checks if an object has all specified properties.
*
* @param object The object to check.
* @param properties The list of properties to check for.
* @returns `true` if the object has all the specified properties; otherwise, `false`.
*
* @example
* // Object with all properties
* console.log(hasProps({a: 1, b: 2}, 'a', 'b')); // true
*
* // Object without all properties
* console.log(hasProps({a: 1, b: 2}, 'a', 'c')); // false
*/
export declare function hasProps(object: any, ...properties: Array<any>): boolean;
/**
* Checks if an index is within the range of a target (array, string, or object).
*
* @param target The target (array, string, or object) to check.
* @param index The index to check.
* @returns `true` if the index is within range; otherwise, `false`.
*
* @example
* // Valid index in array
* console.log(hasIndex([1, 2, 3], 1)); // true
*
* // Invalid index in array
* console.log(hasIndex([1, 2, 3], 3)); // false
*
* // Valid index in string
* console.log(hasIndex('hello', 1)); // true
*
* // Invalid index in string
* console.log(hasIndex('hello', 5)); // false
*/
export declare function hasIndex(target: any, index: any): boolean;
/**
* Checks if the length of a target (array, string, or object) matches a specified length.
*
* @param target The target (array, string, or object) to check.
* @param length The length to compare against.
* @returns `true` if the length of the target matches the specified length; otherwise, `false`.
*
* @example
* // Array with the correct length
* console.log(hasLength([1, 2, 3], 3)); // true
*
* // Array with the incorrect length
* console.log(hasLength([1, 2, 3], 2)); // false
*
* // String with the correct length
* console.log(hasLength('hello', 5)); // true
*
* // String with the incorrect length
* console.log(hasLength('hello', 4)); // false
*
* // Object with the correct number of properties
* console.log(hasLength({a: 1, b: 2}, 2)); // true
*
* // Object with the incorrect number of properties
* console.log(hasLength({a: 1, b: 2}, 1)); // false
*/
export declare function hasLength(target: any, length: any): boolean;
/**
* Checks if a regex has a specific flag.
*
* @param regex The regular expression to check.
* @param flag The flag to check for.
* @returns `true` if the regex has the specified flag; otherwise, `false`.
*
* @example
* // Regex with a specific flag
* console.log(hasFlag(/abc/i, 'i')); // true
*
* // Regex without a specific flag
* console.log(hasFlag(/abc/i, 'g')); // false
*/
export declare function hasFlag(regex: any, flag: any): boolean;
/**
* Checks if an object has a specific key (property name).
*
* @param object The object to check.
* @param key The key to check for.
* @returns `true` if the object has the specified key; otherwise, `false`.
*
* @example
* // Object with the key
* console.log(hasKey({a: 1, b: 2}, 'a')); // true
*
* // Object without the key
* console.log(hasKey({a: 1, b: 2}, 'c')); // false
*/
export declare function hasKey(object: any, key: any): boolean;
/**
* Checks if an object contains all of the specified keys (property names).
*
* @param object The object to check.
* @param keys The array of keys to check for.
* @returns `true` if the object has all the specified keys; otherwise, `false`.
*
* @example
* // Object with all the keys
* console.log(hasKeys({a: 1, b: 2}, 'a', 'b')); // true
*
* // Object missing a key
* console.log(hasKeys({a: 1, b: 2}, 'a', 'c')); // false
*
* // Object with extra keys
* console.log(hasKeys({a: 1, b: 2, c: 3}, 'a', 'b')); // true
*/
export declare function hasKeys(object: any, ...keys: Array<any>): boolean;
/**
* Checks if an (object|array|string) has a specific value.
*
* @param target The (object|array|string) to check.
* @param value The value to check for.
* @returns `true` if the target contains the specified value; otherwise, `false`.
*
* @example
* // Object with the value
* console.log(hasValue({a: 1, b: 2}, 2)); // true
*
* // Array with the value
* console.log(hasValue([1, 2, 3], 2)); // true
*
* // String with the value
* console.log(hasValue('hello world', 'world')); // true
*
* // Object without the value
* console.log(hasValue({a: 1, b: 2}, 3)); // false
*/
export declare function hasValue(target: any, value: any): boolean;
/**
* Checks if an (object|array|string) contains all of the specified values.
*
* @param target The (object|array|string) to check.
* @param values The array of values to check for.
* @returns `true` if the target contains all the specified values; otherwise, `false`.
*
* @example
* // Object with all the values
* console.log(hasValues({a: 1, b: 2}, 1, 2)); // true
*
* // Array with all the values
* console.log(hasValues([1, 2, 3], 1, 3)); // true
*
* // String with all the values
* console.log(hasValues('hello world', 'hello', 'world')); // true
*
* // Array missing a value
* console.log(hasValues(['hello', 'foo'], 'hello', 'bar')); // false
*/
export declare function hasValues(target: any, ...values: Array<any>): boolean;