Comprehensive type checking predicates and value conversion utilities for JavaScript types, cloning, and value comparison operations.
Creates a shallow clone of value.
/**
* Creates a shallow clone of `value`.
* @param value - The value to clone
* @returns Returns the cloned value
*/
function clone<T>(value: T): T;Creates a deep clone of value.
/**
* This method is like `clone` except that it recursively clones `value`.
* @param value - The value to recursively clone
* @returns Returns the deep cloned value
*/
function cloneDeep<T>(value: T): T;Like cloneDeep except that it accepts customizer which is invoked to produce the cloned value.
/**
* This method is like `cloneDeep` except that it accepts `customizer`
* which is invoked to produce the cloned value.
* @param value - The value to recursively clone
* @param customizer - The function to customize cloning
* @returns Returns the deep cloned value
*/
function cloneDeepWith<T>(
value: T,
customizer?: (value: any, key?: string | number, object?: any, stack?: any) => any
): T;Like clone except that it accepts customizer which is invoked to produce the cloned value.
/**
* This method is like `clone` except that it accepts `customizer` which
* is invoked to produce the cloned value.
* @param value - The value to clone
* @param customizer - The function to customize cloning
* @returns Returns the cloned value
*/
function cloneWith<T>(
value: T,
customizer?: (value: any, key?: string | number, object?: any, stack?: any) => any
): T;Checks if object conforms to source by invoking the predicate properties of source with the corresponding property values of object.
/**
* Checks if `object` conforms to `source` by invoking the predicate
* properties of `source` with the corresponding property values of `object`.
* @param object - The object to inspect
* @param source - The object of property predicates to conform to
* @returns Returns `true` if `object` conforms, else `false`
*/
function conformsTo<T>(object: T, source: Record<keyof T, (value: any) => boolean>): boolean;Performs a SameValueZero comparison between two values to determine if they are equivalent.
/**
* Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* comparison between two values to determine if they are equivalent.
* @param value - The value to compare
* @param other - The other value to compare
* @returns Returns `true` if the values are equivalent, else `false`
*/
function eq(value: any, other: any): boolean;Checks if value is greater than other.
/**
* Checks if `value` is greater than `other`.
* @param value - The value to compare
* @param other - The other value to compare
* @returns Returns `true` if `value` is greater than `other`, else `false`
*/
function gt(value: any, other: any): boolean;Checks if value is greater than or equal to other.
/**
* Checks if `value` is greater than or equal to `other`.
* @param value - The value to compare
* @param other - The other value to compare
* @returns Returns `true` if `value` is greater than or equal to `other`, else `false`
*/
function gte(value: any, other: any): boolean;Checks if value is likely an arguments object.
/**
* Checks if `value` is likely an `arguments` object.
* @param value - The value to check
* @returns Returns `true` if `value` is an `arguments` object, else `false`
*/
function isArguments(value?: any): value is IArguments;Checks if value is classified as an Array object.
/**
* Checks if `value` is classified as an `Array` object.
* @param value - The value to check
* @returns Returns `true` if `value` is an array, else `false`
*/
function isArray(value?: any): value is any[];Checks if value is classified as an ArrayBuffer object.
/**
* Checks if `value` is classified as an `ArrayBuffer` object.
* @param value - The value to check
* @returns Returns `true` if `value` is an array buffer, else `false`
*/
function isArrayBuffer(value?: any): value is ArrayBuffer;Checks if value is array-like.
/**
* Checks if `value` is array-like. A value is considered array-like if it's
* not a function and has a `value.length` that's an integer greater than or
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
* @param value - The value to check
* @returns Returns `true` if `value` is array-like, else `false`
*/
function isArrayLike(value?: any): value is ArrayLike<any>;Checks if value is array-like object.
/**
* This method is like `isArrayLike` except that it also checks if `value`
* is an object.
* @param value - The value to check
* @returns Returns `true` if `value` is an array-like object, else `false`
*/
function isArrayLikeObject(value?: any): value is ArrayLike<any> & object;Checks if value is classified as a boolean primitive or object.
/**
* Checks if `value` is classified as a boolean primitive or object.
* @param value - The value to check
* @returns Returns `true` if `value` is a boolean, else `false`
*/
function isBoolean(value?: any): value is boolean;Checks if value is a buffer.
/**
* Checks if `value` is a buffer.
* @param value - The value to check
* @returns Returns `true` if `value` is a buffer, else `false`
*/
function isBuffer(value?: any): boolean;Checks if value is classified as a Date object.
/**
* Checks if `value` is classified as a `Date` object.
* @param value - The value to check
* @returns Returns `true` if `value` is a date object, else `false`
*/
function isDate(value?: any): value is Date;Checks if value is likely a DOM element.
/**
* Checks if `value` is likely a DOM element.
* @param value - The value to check
* @returns Returns `true` if `value` is a DOM element, else `false`
*/
function isElement(value?: any): boolean;Checks if value is an empty object, collection, map, or set.
/**
* Checks if `value` is an empty object, collection, map, or set.
* Objects are considered empty if they have no own enumerable string keyed
* properties. Array-like values such as `arguments` objects, arrays, buffers,
* strings, or jQuery-like collections are considered empty if they have a
* `length` of `0`. Similarly, maps and sets are considered empty if they have
* a `size` of `0`.
* @param value - The value to check
* @returns Returns `true` if `value` is empty, else `false`
*/
function isEmpty(value?: any): boolean;Performs a deep comparison between two values to determine if they are equivalent.
/**
* Performs a deep comparison between two values to determine if they are
* equivalent.
* @param value - The value to compare
* @param other - The other value to compare
* @returns Returns `true` if the values are equivalent, else `false`
*/
function isEqual(value: any, other: any): boolean;Like isEqual except that it accepts customizer which is invoked to compare values.
/**
* This method is like `isEqual` except that it accepts `customizer` which
* is invoked to compare values.
* @param value - The value to compare
* @param other - The other value to compare
* @param customizer - The function to customize comparisons
* @returns Returns `true` if the values are equivalent, else `false`
*/
function isEqualWith(
value: any,
other: any,
customizer?: (objValue: any, othValue: any, key?: PropertyKey, object?: any, other?: any, stack?: any) => boolean | undefined
): boolean;Checks if value is an Error, EvalError, RangeError, ReferenceError, SyntaxError, TypeError, or URIError object.
/**
* Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
* `SyntaxError`, `TypeError`, or `URIError` object.
* @param value - The value to check
* @returns Returns `true` if `value` is an error object, else `false`
*/
function isError(value?: any): value is Error;Checks if value is a finite primitive number.
/**
* Checks if `value` is a finite primitive number.
* @param value - The value to check
* @returns Returns `true` if `value` is a finite number, else `false`
*/
function isFinite(value?: any): value is number;Checks if value is classified as a Function object.
/**
* Checks if `value` is classified as a `Function` object.
* @param value - The value to check
* @returns Returns `true` if `value` is a function, else `false`
*/
function isFunction(value?: any): value is Function;Checks if value is an integer.
/**
* Checks if `value` is an integer.
* @param value - The value to check
* @returns Returns `true` if `value` is an integer, else `false`
*/
function isInteger(value?: any): value is number;Checks if value is a valid array-like length.
/**
* Checks if `value` is a valid array-like length.
* @param value - The value to check
* @returns Returns `true` if `value` is a valid length, else `false`
*/
function isLength(value?: any): boolean;Checks if value is classified as a Map object.
/**
* Checks if `value` is classified as a `Map` object.
* @param value - The value to check
* @returns Returns `true` if `value` is a map, else `false`
*/
function isMap(value?: any): value is Map<any, any>;Performs a partial deep comparison between object and source to determine if object contains equivalent property values.
/**
* Performs a partial deep comparison between `object` and `source` to
* determine if `object` contains equivalent property values.
* @param object - The object to inspect
* @param source - The object of property values to match
* @returns Returns `true` if `object` is a match, else `false`
*/
function isMatch(object: any, source: any): boolean;Like isMatch except that it accepts customizer which is invoked to compare values.
/**
* This method is like `isMatch` except that it accepts `customizer` which
* is invoked to compare values.
* @param object - The object to inspect
* @param source - The object of property values to match
* @param customizer - The function to customize comparisons
* @returns Returns `true` if `object` is a match, else `false`
*/
function isMatchWith(
object: any,
source: any,
customizer?: (objValue: any, srcValue: any, key?: PropertyKey, object?: any, source?: any) => boolean | undefined
): boolean;Checks if value is NaN.
/**
* Checks if `value` is `NaN`.
* @param value - The value to check
* @returns Returns `true` if `value` is `NaN`, else `false`
*/
function isNaN(value?: any): boolean;Checks if value is a pristine native function.
/**
* Checks if `value` is a pristine native function.
* @param value - The value to check
* @returns Returns `true` if `value` is a native function, else `false`
*/
function isNative(value?: any): boolean;Checks if value is null or undefined.
/**
* Checks if `value` is `null` or `undefined`.
* @param value - The value to check
* @returns Returns `true` if `value` is nullish, else `false`
*/
function isNil(value?: any): value is null | undefined;Checks if value is null.
/**
* Checks if `value` is `null`.
* @param value - The value to check
* @returns Returns `true` if `value` is `null`, else `false`
*/
function isNull(value?: any): value is null;Checks if value is classified as a Number primitive or object.
/**
* Checks if `value` is classified as a `Number` primitive or object.
* @param value - The value to check
* @returns Returns `true` if `value` is a number, else `false`
*/
function isNumber(value?: any): value is number;Checks if value is the language type of Object.
/**
* Checks if `value` is the [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
* @param value - The value to check
* @returns Returns `true` if `value` is an object, else `false`
*/
function isObject(value?: any): value is object;Checks if value is object-like.
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
* @param value - The value to check
* @returns Returns `true` if `value` is object-like, else `false`
*/
function isObjectLike(value?: any): boolean;Checks if value is a plain object, that is, an object created by the Object constructor or one with a [[Prototype]] of null.
/**
* Checks if `value` is a plain object, that is, an object created by the
* `Object` constructor or one with a `[[Prototype]]` of `null`.
* @param value - The value to check
* @returns Returns `true` if `value` is a plain object, else `false`
*/
function isPlainObject(value?: any): boolean;Checks if value is classified as a RegExp object.
/**
* Checks if `value` is classified as a `RegExp` object.
* @param value - The value to check
* @returns Returns `true` if `value` is a regexp, else `false`
*/
function isRegExp(value?: any): value is RegExp;Checks if value is a safe integer.
/**
* Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
* double precision number which isn't the result of a rounded unsafe integer.
* @param value - The value to check
* @returns Returns `true` if `value` is a safe integer, else `false`
*/
function isSafeInteger(value?: any): value is number;Checks if value is classified as a Set object.
/**
* Checks if `value` is classified as a `Set` object.
* @param value - The value to check
* @returns Returns `true` if `value` is a set, else `false`
*/
function isSet(value?: any): value is Set<any>;Checks if value is classified as a String primitive or object.
/**
* Checks if `value` is classified as a `String` primitive or object.
* @param value - The value to check
* @returns Returns `true` if `value` is a string, else `false`
*/
function isString(value?: any): value is string;Checks if value is classified as a Symbol primitive or object.
/**
* Checks if `value` is classified as a `Symbol` primitive or object.
* @param value - The value to check
* @returns Returns `true` if `value` is a symbol, else `false`
*/
function isSymbol(value?: any): value is symbol;Checks if value is classified as a typed array.
/**
* Checks if `value` is classified as a typed array.
* @param value - The value to check
* @returns Returns `true` if `value` is a typed array, else `false`
*/
function isTypedArray(value?: any): value is TypedArray;Checks if value is undefined.
/**
* Checks if `value` is `undefined`.
* @param value - The value to check
* @returns Returns `true` if `value` is `undefined`, else `false`
*/
function isUndefined(value?: any): value is undefined;Checks if value is classified as a WeakMap object.
/**
* Checks if `value` is classified as a `WeakMap` object.
* @param value - The value to check
* @returns Returns `true` if `value` is a weak map, else `false`
*/
function isWeakMap(value?: any): value is WeakMap<any, any>;Checks if value is classified as a WeakSet object.
/**
* Checks if `value` is classified as a `WeakSet` object.
* @param value - The value to check
* @returns Returns `true` if `value` is a weak set, else `false`
*/
function isWeakSet(value?: any): value is WeakSet<any>;Checks if value is less than other.
/**
* Checks if `value` is less than `other`.
* @param value - The value to compare
* @param other - The other value to compare
* @returns Returns `true` if `value` is less than `other`, else `false`
*/
function lt(value: any, other: any): boolean;Checks if value is less than or equal to other.
/**
* Checks if `value` is less than or equal to `other`.
* @param value - The value to compare
* @param other - The other value to compare
* @returns Returns `true` if `value` is less than or equal to `other`, else `false`
*/
function lte(value: any, other: any): boolean;Converts value to an array.
/**
* Converts `value` to an array.
* @param value - The value to convert
* @returns Returns the converted array
*/
function toArray<T>(value: ArrayLike<T> | T): T[];Converts value to a finite number.
/**
* Converts `value` to a finite number.
* @param value - The value to convert
* @returns Returns the converted number
*/
function toFinite(value?: any): number;Converts value to an integer.
/**
* Converts `value` to an integer.
* @param value - The value to convert
* @returns Returns the converted integer
*/
function toInteger(value?: any): number;Converts value to an integer suitable for use as the length of an array-like object.
/**
* Converts `value` to an integer suitable for use as the length of an
* array-like object.
* @param value - The value to convert
* @returns Returns the converted integer
*/
function toLength(value?: any): number;Converts value to a number.
/**
* Converts `value` to a number.
* @param value - The value to process
* @returns Returns the number
*/
function toNumber(value?: any): number;Converts value to a plain object flattening inherited enumerable string keyed properties of value to own properties of the plain object.
/**
* Converts `value` to a plain object flattening inherited enumerable string
* keyed properties of `value` to own properties of the plain object.
* @param value - The value to convert
* @returns Returns the converted plain object
*/
function toPlainObject(value?: any): any;Converts value to a safe integer.
/**
* Converts `value` to a safe integer. A safe integer can be compared and
* represented correctly.
* @param value - The value to convert
* @returns Returns the converted integer
*/
function toSafeInteger(value?: any): number;Converts value to a string.
/**
* Converts `value` to a string. An empty string is returned for `null`
* and `undefined` values. The sign of `-0` is preserved.
* @param value - The value to convert
* @returns Returns the converted string
*/
function toString(value?: any): string;type ArrayLike<T> = {
readonly length: number;
readonly [n: number]: T;
};
type PropertyKey = string | number | symbol;
type TypedArray =
| Int8Array
| Uint8Array
| Uint8ClampedArray
| Int16Array
| Uint16Array
| Int32Array
| Uint32Array
| Float32Array
| Float64Array;