Functions
Browse all available utility functions by category
castArray
Casts value as an array if it's not one.
Example:
castArray(1); // [1]clone
Creates a shallow clone of value.
Example:
const objects = [{ 'a': 1 }, { 'b': 2 }];cloneDeep
This method is like clone except that it recursively clones value.
Example:
const objects = [{ 'a': 1 }, { 'b': 2 }];cloneDeepWith
This method is like cloneDeep except that it accepts customizer which is invoked to produce the cloned value.
Example:
function customizer(value: unknown) {cloneWith
This method is like clone except that it accepts customizer which is invoked to produce the cloned value.
Example:
function customizer(value: unknown) {conformsTo
Checks if object conforms to source by invoking the predicate properties of source with the corresponding property values of object.
Example:
const object = { 'a': 1, 'b': 2 };eq
Performs a SameValueZero comparison between two values to determine if they are equivalent.
Example:
const object = { 'a': 1 };gt
Checks if value is greater than other.
Example:
gt(3, 1); // truegte
Checks if value is greater than or equal to other.
Example:
gte(3, 1); // trueisArguments
Checks if value is likely an arguments object.
Example:
isArguments(function() { return arguments; }()); // trueisArray
Checks if value is classified as an Array object.
Example:
isArray([1, 2, 3]); // trueisArrayBuffer
Checks if value is classified as an ArrayBuffer object.
Example:
isArrayBuffer(new ArrayBuffer(2)); // trueisArrayLike
Checks if value is array-like.
Example:
isArrayLike([1, 2, 3]); // trueisArrayLikeObject
This method is like isArrayLike except that it also checks if value is an object.
Example:
isArrayLikeObject([1, 2, 3]); // trueisBoolean
Checks if value is classified as a Boolean primitive or object.
Example:
isBoolean(false); // trueisBuffer
Checks if value is a Buffer. Note: This method returns false in browser environments.
Example:
isBuffer(Buffer.alloc(2)); // true (Node.js)isDate
Checks if value is classified as a Date object.
Example:
isDate(new Date); // trueisElement
Checks if value is likely a DOM element.
Example:
isElement(document.body); // trueisEmpty
Checks if value is an empty object, collection, map, or set.
Example:
isEmpty(null); // trueisEqual
Performs a deep comparison between two values to determine if they are equivalent.
Example:
const object = { 'a': 1 };isEqualWith
This method is like isEqual except that it accepts customizer which is invoked to compare values.
Example:
function isGreeting(value: unknown) {isError
Checks if value is an Error, EvalError, RangeError, ReferenceError, SyntaxError, TypeError, or URIError object.
Example:
isError(new Error); // trueisFinite
Checks if value is a finite primitive number.
Example:
isFinite(3); // trueisFunction
Checks if value is classified as a Function object.
Example:
isFunction(() => {}); // trueisInteger
Checks if value is an integer.
Example:
isInteger(3); // trueisLength
Checks if value is a valid array-like length.
Example:
isLength(3); // trueisMap
Checks if value is classified as a Map object.
Example:
isMap(new Map); // trueisMatch
Performs a partial deep comparison between object and source to determine if object contains equivalent property values.
Example:
const object = { 'a': 1, 'b': 2 };isMatchWith
This method is like isMatch except that it accepts customizer which is invoked to compare values.
Example:
function isGreeting(value: unknown) {isNaN
Checks if value is NaN.
Example:
isNaN(NaN); // trueisNative
Checks if value is a native function.
Example:
isNative(Array.prototype.push); // trueisNil
Checks if value is null or undefined.
Example:
isNil(null); // trueisNull
Checks if value is null.
Example:
isNull(null); // trueisNumber
Checks if value is classified as a Number primitive or object.
Example:
isNumber(3); // trueisObject
Checks if value is the language type of Object.
Example:
isObject({}); // trueisObjectLike
Checks if value is object-like.
Example:
isObjectLike({}); // trueisPlainObject
Checks if value is a plain object.
Example:
function Foo() {isRegExp
Checks if value is classified as a RegExp object.
Example:
isRegExp(/abc/); // trueisSafeInteger
Checks if value is a safe integer.
Example:
isSafeInteger(3); // trueisSet
Checks if value is classified as a Set object.
Example:
isSet(new Set); // trueisString
Checks if value is classified as a String primitive or object.
Example:
isString('abc'); // trueisSymbol
Checks if value is classified as a Symbol primitive or object.
Example:
isSymbol(Symbol.iterator); // trueisTypedArray
Checks if value is classified as a typed array.
Example:
isTypedArray(new Uint8Array); // trueisUndefined
Checks if value is undefined.
Example:
isUndefined(void 0); // trueisWeakMap
Checks if value is classified as a WeakMap object.
Example:
isWeakMap(new WeakMap); // trueisWeakSet
Checks if value is classified as a WeakSet object.
Example:
isWeakSet(new WeakSet); // truelt
Checks if value is less than other.
Example:
lt(1, 3); // truelte
Checks if value is less than or equal to other.
Example:
lte(1, 3); // truetoArray
Converts value to an array.
Example:
toArray({ 'a': 1, 'b': 2 }); // [1, 2]toFinite
Converts value to a finite number.
Example:
toFinite(3.2); // 3.2toInteger
Converts value to an integer.
Example:
toInteger(3.2); // 3toLength
Converts value to an integer suitable for use as the length of an array-like object.
Example:
toLength(3.2); // 3toNumber
Converts value to a number.
Example:
toNumber(3.2); // 3.2toPlainObject
Converts value to a plain object flattening inherited enumerable string keyed properties of value to own properties of the plain object.
Example:
function Foo() {toSafeInteger
Converts value to a safe integer.
Example:
toSafeInteger(3.2); // 3toString
Converts value to a string.
Example:
toString(null); // ''