- Spec files
npm-lodash
Describes: pkg:npm/lodash@4.9.x
- Description
- A comprehensive JavaScript utility library with 296+ functions for arrays, objects, strings, and functional programming
- Author
- tessl
- Last updated
lang-methods.md docs/
1# Language Methods23Comprehensive type checking predicates and value conversion utilities for JavaScript types, cloning, and value comparison operations.45## Capabilities67### Clone89Creates a shallow clone of value.1011```javascript { .api }12/**13* Creates a shallow clone of `value`.14* @param value - The value to clone15* @returns Returns the cloned value16*/17function clone<T>(value: T): T;18```1920### Clone Deep2122Creates a deep clone of value.2324```javascript { .api }25/**26* This method is like `clone` except that it recursively clones `value`.27* @param value - The value to recursively clone28* @returns Returns the deep cloned value29*/30function cloneDeep<T>(value: T): T;31```3233### Clone Deep With3435Like cloneDeep except that it accepts customizer which is invoked to produce the cloned value.3637```javascript { .api }38/**39* This method is like `cloneDeep` except that it accepts `customizer`40* which is invoked to produce the cloned value.41* @param value - The value to recursively clone42* @param customizer - The function to customize cloning43* @returns Returns the deep cloned value44*/45function cloneDeepWith<T>(46value: T,47customizer?: (value: any, key?: string | number, object?: any, stack?: any) => any48): T;49```5051### Clone With5253Like clone except that it accepts customizer which is invoked to produce the cloned value.5455```javascript { .api }56/**57* This method is like `clone` except that it accepts `customizer` which58* is invoked to produce the cloned value.59* @param value - The value to clone60* @param customizer - The function to customize cloning61* @returns Returns the cloned value62*/63function cloneWith<T>(64value: T,65customizer?: (value: any, key?: string | number, object?: any, stack?: any) => any66): T;67```6869### Conforms To7071Checks if object conforms to source by invoking the predicate properties of source with the corresponding property values of object.7273```javascript { .api }74/**75* Checks if `object` conforms to `source` by invoking the predicate76* properties of `source` with the corresponding property values of `object`.77* @param object - The object to inspect78* @param source - The object of property predicates to conform to79* @returns Returns `true` if `object` conforms, else `false`80*/81function conformsTo<T>(object: T, source: Record<keyof T, (value: any) => boolean>): boolean;82```8384### Eq8586Performs a SameValueZero comparison between two values to determine if they are equivalent.8788```javascript { .api }89/**90* Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)91* comparison between two values to determine if they are equivalent.92* @param value - The value to compare93* @param other - The other value to compare94* @returns Returns `true` if the values are equivalent, else `false`95*/96function eq(value: any, other: any): boolean;97```9899### Gt100101Checks if value is greater than other.102103```javascript { .api }104/**105* Checks if `value` is greater than `other`.106* @param value - The value to compare107* @param other - The other value to compare108* @returns Returns `true` if `value` is greater than `other`, else `false`109*/110function gt(value: any, other: any): boolean;111```112113### Gte114115Checks if value is greater than or equal to other.116117```javascript { .api }118/**119* Checks if `value` is greater than or equal to `other`.120* @param value - The value to compare121* @param other - The other value to compare122* @returns Returns `true` if `value` is greater than or equal to `other`, else `false`123*/124function gte(value: any, other: any): boolean;125```126127### Is Arguments128129Checks if value is likely an arguments object.130131```javascript { .api }132/**133* Checks if `value` is likely an `arguments` object.134* @param value - The value to check135* @returns Returns `true` if `value` is an `arguments` object, else `false`136*/137function isArguments(value?: any): value is IArguments;138```139140### Is Array141142Checks if value is classified as an Array object.143144```javascript { .api }145/**146* Checks if `value` is classified as an `Array` object.147* @param value - The value to check148* @returns Returns `true` if `value` is an array, else `false`149*/150function isArray(value?: any): value is any[];151```152153### Is Array Buffer154155Checks if value is classified as an ArrayBuffer object.156157```javascript { .api }158/**159* Checks if `value` is classified as an `ArrayBuffer` object.160* @param value - The value to check161* @returns Returns `true` if `value` is an array buffer, else `false`162*/163function isArrayBuffer(value?: any): value is ArrayBuffer;164```165166### Is Array Like167168Checks if value is array-like.169170```javascript { .api }171/**172* Checks if `value` is array-like. A value is considered array-like if it's173* not a function and has a `value.length` that's an integer greater than or174* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.175* @param value - The value to check176* @returns Returns `true` if `value` is array-like, else `false`177*/178function isArrayLike(value?: any): value is ArrayLike<any>;179```180181### Is Array Like Object182183Checks if value is array-like object.184185```javascript { .api }186/**187* This method is like `isArrayLike` except that it also checks if `value`188* is an object.189* @param value - The value to check190* @returns Returns `true` if `value` is an array-like object, else `false`191*/192function isArrayLikeObject(value?: any): value is ArrayLike<any> & object;193```194195### Is Boolean196197Checks if value is classified as a boolean primitive or object.198199```javascript { .api }200/**201* Checks if `value` is classified as a boolean primitive or object.202* @param value - The value to check203* @returns Returns `true` if `value` is a boolean, else `false`204*/205function isBoolean(value?: any): value is boolean;206```207208### Is Buffer209210Checks if value is a buffer.211212```javascript { .api }213/**214* Checks if `value` is a buffer.215* @param value - The value to check216* @returns Returns `true` if `value` is a buffer, else `false`217*/218function isBuffer(value?: any): boolean;219```220221### Is Date222223Checks if value is classified as a Date object.224225```javascript { .api }226/**227* Checks if `value` is classified as a `Date` object.228* @param value - The value to check229* @returns Returns `true` if `value` is a date object, else `false`230*/231function isDate(value?: any): value is Date;232```233234### Is Element235236Checks if value is likely a DOM element.237238```javascript { .api }239/**240* Checks if `value` is likely a DOM element.241* @param value - The value to check242* @returns Returns `true` if `value` is a DOM element, else `false`243*/244function isElement(value?: any): boolean;245```246247### Is Empty248249Checks if value is an empty object, collection, map, or set.250251```javascript { .api }252/**253* Checks if `value` is an empty object, collection, map, or set.254* Objects are considered empty if they have no own enumerable string keyed255* properties. Array-like values such as `arguments` objects, arrays, buffers,256* strings, or jQuery-like collections are considered empty if they have a257* `length` of `0`. Similarly, maps and sets are considered empty if they have258* a `size` of `0`.259* @param value - The value to check260* @returns Returns `true` if `value` is empty, else `false`261*/262function isEmpty(value?: any): boolean;263```264265### Is Equal266267Performs a deep comparison between two values to determine if they are equivalent.268269```javascript { .api }270/**271* Performs a deep comparison between two values to determine if they are272* equivalent.273* @param value - The value to compare274* @param other - The other value to compare275* @returns Returns `true` if the values are equivalent, else `false`276*/277function isEqual(value: any, other: any): boolean;278```279280### Is Equal With281282Like isEqual except that it accepts customizer which is invoked to compare values.283284```javascript { .api }285/**286* This method is like `isEqual` except that it accepts `customizer` which287* is invoked to compare values.288* @param value - The value to compare289* @param other - The other value to compare290* @param customizer - The function to customize comparisons291* @returns Returns `true` if the values are equivalent, else `false`292*/293function isEqualWith(294value: any,295other: any,296customizer?: (objValue: any, othValue: any, key?: PropertyKey, object?: any, other?: any, stack?: any) => boolean | undefined297): boolean;298```299300### Is Error301302Checks if value is an Error, EvalError, RangeError, ReferenceError, SyntaxError, TypeError, or URIError object.303304```javascript { .api }305/**306* Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,307* `SyntaxError`, `TypeError`, or `URIError` object.308* @param value - The value to check309* @returns Returns `true` if `value` is an error object, else `false`310*/311function isError(value?: any): value is Error;312```313314### Is Finite315316Checks if value is a finite primitive number.317318```javascript { .api }319/**320* Checks if `value` is a finite primitive number.321* @param value - The value to check322* @returns Returns `true` if `value` is a finite number, else `false`323*/324function isFinite(value?: any): value is number;325```326327### Is Function328329Checks if value is classified as a Function object.330331```javascript { .api }332/**333* Checks if `value` is classified as a `Function` object.334* @param value - The value to check335* @returns Returns `true` if `value` is a function, else `false`336*/337function isFunction(value?: any): value is Function;338```339340### Is Integer341342Checks if value is an integer.343344```javascript { .api }345/**346* Checks if `value` is an integer.347* @param value - The value to check348* @returns Returns `true` if `value` is an integer, else `false`349*/350function isInteger(value?: any): value is number;351```352353### Is Length354355Checks if value is a valid array-like length.356357```javascript { .api }358/**359* Checks if `value` is a valid array-like length.360* @param value - The value to check361* @returns Returns `true` if `value` is a valid length, else `false`362*/363function isLength(value?: any): boolean;364```365366### Is Map367368Checks if value is classified as a Map object.369370```javascript { .api }371/**372* Checks if `value` is classified as a `Map` object.373* @param value - The value to check374* @returns Returns `true` if `value` is a map, else `false`375*/376function isMap(value?: any): value is Map<any, any>;377```378379### Is Match380381Performs a partial deep comparison between object and source to determine if object contains equivalent property values.382383```javascript { .api }384/**385* Performs a partial deep comparison between `object` and `source` to386* determine if `object` contains equivalent property values.387* @param object - The object to inspect388* @param source - The object of property values to match389* @returns Returns `true` if `object` is a match, else `false`390*/391function isMatch(object: any, source: any): boolean;392```393394### Is Match With395396Like isMatch except that it accepts customizer which is invoked to compare values.397398```javascript { .api }399/**400* This method is like `isMatch` except that it accepts `customizer` which401* is invoked to compare values.402* @param object - The object to inspect403* @param source - The object of property values to match404* @param customizer - The function to customize comparisons405* @returns Returns `true` if `object` is a match, else `false`406*/407function isMatchWith(408object: any,409source: any,410customizer?: (objValue: any, srcValue: any, key?: PropertyKey, object?: any, source?: any) => boolean | undefined411): boolean;412```413414### Is NaN415416Checks if value is NaN.417418```javascript { .api }419/**420* Checks if `value` is `NaN`.421* @param value - The value to check422* @returns Returns `true` if `value` is `NaN`, else `false`423*/424function isNaN(value?: any): boolean;425```426427### Is Native428429Checks if value is a pristine native function.430431```javascript { .api }432/**433* Checks if `value` is a pristine native function.434* @param value - The value to check435* @returns Returns `true` if `value` is a native function, else `false`436*/437function isNative(value?: any): boolean;438```439440### Is Nil441442Checks if value is null or undefined.443444```javascript { .api }445/**446* Checks if `value` is `null` or `undefined`.447* @param value - The value to check448* @returns Returns `true` if `value` is nullish, else `false`449*/450function isNil(value?: any): value is null | undefined;451```452453### Is Null454455Checks if value is null.456457```javascript { .api }458/**459* Checks if `value` is `null`.460* @param value - The value to check461* @returns Returns `true` if `value` is `null`, else `false`462*/463function isNull(value?: any): value is null;464```465466### Is Number467468Checks if value is classified as a Number primitive or object.469470```javascript { .api }471/**472* Checks if `value` is classified as a `Number` primitive or object.473* @param value - The value to check474* @returns Returns `true` if `value` is a number, else `false`475*/476function isNumber(value?: any): value is number;477```478479### Is Object480481Checks if value is the language type of Object.482483```javascript { .api }484/**485* Checks if `value` is the [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)486* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)487* @param value - The value to check488* @returns Returns `true` if `value` is an object, else `false`489*/490function isObject(value?: any): value is object;491```492493### Is Object Like494495Checks if value is object-like.496497```javascript { .api }498/**499* Checks if `value` is object-like. A value is object-like if it's not `null`500* and has a `typeof` result of "object".501* @param value - The value to check502* @returns Returns `true` if `value` is object-like, else `false`503*/504function isObjectLike(value?: any): boolean;505```506507### Is Plain Object508509Checks if value is a plain object, that is, an object created by the Object constructor or one with a [[Prototype]] of null.510511```javascript { .api }512/**513* Checks if `value` is a plain object, that is, an object created by the514* `Object` constructor or one with a `[[Prototype]]` of `null`.515* @param value - The value to check516* @returns Returns `true` if `value` is a plain object, else `false`517*/518function isPlainObject(value?: any): boolean;519```520521### Is RegExp522523Checks if value is classified as a RegExp object.524525```javascript { .api }526/**527* Checks if `value` is classified as a `RegExp` object.528* @param value - The value to check529* @returns Returns `true` if `value` is a regexp, else `false`530*/531function isRegExp(value?: any): value is RegExp;532```533534### Is Safe Integer535536Checks if value is a safe integer.537538```javascript { .api }539/**540* Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754541* double precision number which isn't the result of a rounded unsafe integer.542* @param value - The value to check543* @returns Returns `true` if `value` is a safe integer, else `false`544*/545function isSafeInteger(value?: any): value is number;546```547548### Is Set549550Checks if value is classified as a Set object.551552```javascript { .api }553/**554* Checks if `value` is classified as a `Set` object.555* @param value - The value to check556* @returns Returns `true` if `value` is a set, else `false`557*/558function isSet(value?: any): value is Set<any>;559```560561### Is String562563Checks if value is classified as a String primitive or object.564565```javascript { .api }566/**567* Checks if `value` is classified as a `String` primitive or object.568* @param value - The value to check569* @returns Returns `true` if `value` is a string, else `false`570*/571function isString(value?: any): value is string;572```573574### Is Symbol575576Checks if value is classified as a Symbol primitive or object.577578```javascript { .api }579/**580* Checks if `value` is classified as a `Symbol` primitive or object.581* @param value - The value to check582* @returns Returns `true` if `value` is a symbol, else `false`583*/584function isSymbol(value?: any): value is symbol;585```586587### Is Typed Array588589Checks if value is classified as a typed array.590591```javascript { .api }592/**593* Checks if `value` is classified as a typed array.594* @param value - The value to check595* @returns Returns `true` if `value` is a typed array, else `false`596*/597function isTypedArray(value?: any): value is TypedArray;598```599600### Is Undefined601602Checks if value is undefined.603604```javascript { .api }605/**606* Checks if `value` is `undefined`.607* @param value - The value to check608* @returns Returns `true` if `value` is `undefined`, else `false`609*/610function isUndefined(value?: any): value is undefined;611```612613### Is Weak Map614615Checks if value is classified as a WeakMap object.616617```javascript { .api }618/**619* Checks if `value` is classified as a `WeakMap` object.620* @param value - The value to check621* @returns Returns `true` if `value` is a weak map, else `false`622*/623function isWeakMap(value?: any): value is WeakMap<any, any>;624```625626### Is Weak Set627628Checks if value is classified as a WeakSet object.629630```javascript { .api }631/**632* Checks if `value` is classified as a `WeakSet` object.633* @param value - The value to check634* @returns Returns `true` if `value` is a weak set, else `false`635*/636function isWeakSet(value?: any): value is WeakSet<any>;637```638639### Lt640641Checks if value is less than other.642643```javascript { .api }644/**645* Checks if `value` is less than `other`.646* @param value - The value to compare647* @param other - The other value to compare648* @returns Returns `true` if `value` is less than `other`, else `false`649*/650function lt(value: any, other: any): boolean;651```652653### Lte654655Checks if value is less than or equal to other.656657```javascript { .api }658/**659* Checks if `value` is less than or equal to `other`.660* @param value - The value to compare661* @param other - The other value to compare662* @returns Returns `true` if `value` is less than or equal to `other`, else `false`663*/664function lte(value: any, other: any): boolean;665```666667### To Array668669Converts value to an array.670671```javascript { .api }672/**673* Converts `value` to an array.674* @param value - The value to convert675* @returns Returns the converted array676*/677function toArray<T>(value: ArrayLike<T> | T): T[];678```679680### To Finite681682Converts value to a finite number.683684```javascript { .api }685/**686* Converts `value` to a finite number.687* @param value - The value to convert688* @returns Returns the converted number689*/690function toFinite(value?: any): number;691```692693### To Integer694695Converts value to an integer.696697```javascript { .api }698/**699* Converts `value` to an integer.700* @param value - The value to convert701* @returns Returns the converted integer702*/703function toInteger(value?: any): number;704```705706### To Length707708Converts value to an integer suitable for use as the length of an array-like object.709710```javascript { .api }711/**712* Converts `value` to an integer suitable for use as the length of an713* array-like object.714* @param value - The value to convert715* @returns Returns the converted integer716*/717function toLength(value?: any): number;718```719720### To Number721722Converts value to a number.723724```javascript { .api }725/**726* Converts `value` to a number.727* @param value - The value to process728* @returns Returns the number729*/730function toNumber(value?: any): number;731```732733### To Plain Object734735Converts value to a plain object flattening inherited enumerable string keyed properties of value to own properties of the plain object.736737```javascript { .api }738/**739* Converts `value` to a plain object flattening inherited enumerable string740* keyed properties of `value` to own properties of the plain object.741* @param value - The value to convert742* @returns Returns the converted plain object743*/744function toPlainObject(value?: any): any;745```746747### To Safe Integer748749Converts value to a safe integer.750751```javascript { .api }752/**753* Converts `value` to a safe integer. A safe integer can be compared and754* represented correctly.755* @param value - The value to convert756* @returns Returns the converted integer757*/758function toSafeInteger(value?: any): number;759```760761### To String762763Converts value to a string.764765```javascript { .api }766/**767* Converts `value` to a string. An empty string is returned for `null`768* and `undefined` values. The sign of `-0` is preserved.769* @param value - The value to convert770* @returns Returns the converted string771*/772function toString(value?: any): string;773```774775## Types776777```javascript { .api }778type ArrayLike<T> = {779readonly length: number;780readonly [n: number]: T;781};782783type PropertyKey = string | number | symbol;784785type TypedArray =786| Int8Array787| Uint8Array788| Uint8ClampedArray789| Int16Array790| Uint16Array791| Int32Array792| Uint32Array793| Float32Array794| Float64Array;795```