- 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
array-methods.md docs/
1# Array Methods23Comprehensive array manipulation utilities for chunking, flattening, filtering, transforming, and working with arrays in JavaScript.45## Capabilities67### Cast Array89Casts value as an array if it's not one.1011```javascript { .api }12/**13* Casts `value` as an array if it's not one.14* @param value - The value to inspect15* @returns Returns the cast array16*/17function castArray<T>(value?: T | T[]): T[];18```1920### Chunk2122Creates an array of elements split into groups the length of size.2324```javascript { .api }25/**26* Creates an array of elements split into groups the length of `size`.27* @param array - The array to process28* @param size - The length of each chunk (defaults to 1)29* @returns Returns the new array of chunks30*/31function chunk<T>(array: T[], size?: number): T[][];32```3334**Usage Examples:**3536```javascript37import { chunk } from 'lodash';3839// Basic chunking40const numbers = [1, 2, 3, 4, 5, 6, 7, 8];41console.log(chunk(numbers, 3));42// => [[1, 2, 3], [4, 5, 6], [7, 8]]4344// Chunking with different sizes45console.log(chunk(numbers, 2));46// => [[1, 2], [3, 4], [5, 6], [7, 8]]4748// Single element chunks (default)49console.log(chunk([1, 2, 3]));50// => [[1], [2], [3]]5152// Common use case: pagination53const users = [54{ name: 'Alice' }, { name: 'Bob' }, { name: 'Charlie' },55{ name: 'David' }, { name: 'Eve' }, { name: 'Frank' }56];57const pages = chunk(users, 2); // 2 users per page58console.log(pages);59// => [60// [{ name: 'Alice' }, { name: 'Bob' }],61// [{ name: 'Charlie' }, { name: 'David' }],62// [{ name: 'Eve' }, { name: 'Frank' }]63// ]64```6566### Compact6768Creates an array with all falsey values removed.6970```javascript { .api }71/**72* Creates an array with all falsey values removed. The values false, null,73* 0, "", undefined, and NaN are falsey.74* @param array - The array to compact75* @returns Returns the new array of filtered values76*/77function compact<T>(array: (T | null | undefined | false | 0 | "")[]): T[];78```7980### Concat8182Creates a new array concatenating array with any additional arrays and/or values.8384```javascript { .api }85/**86* Creates a new array concatenating `array` with any additional arrays and/or values.87* @param array - The array to concatenate88* @param values - The values to concatenate89* @returns Returns the new concatenated array90*/91function concat<T>(array: T[], ...values: Array<T | T[]>): T[];92```9394### Difference9596Creates an array of unique values that are in the first array but not in the other given arrays.9798```javascript { .api }99/**100* Creates an array of `array` values not included in the other given arrays101* using SameValueZero for equality comparisons.102* @param array - The array to inspect103* @param values - The values to exclude104* @returns Returns the new array of filtered values105*/106function difference<T>(array: T[], ...values: T[][]): T[];107```108109### Difference By110111Like `difference` except that it accepts `iteratee` which is invoked for each element to generate the criterion by which they're compared.112113```javascript { .api }114/**115* This method is like `difference` except that it accepts `iteratee` which116* is invoked for each element of `array` and `values` to generate the criterion117* by which they're compared.118* @param array - The array to inspect119* @param values - The values to exclude120* @param iteratee - The iteratee invoked per element121* @returns Returns the new array of filtered values122*/123function differenceBy<T>(124array: T[],125values: T[],126iteratee?: string | ((value: T) => any)127): T[];128```129130### Difference With131132Like `difference` except that it accepts `comparator` which is invoked to compare elements.133134```javascript { .api }135/**136* This method is like `difference` except that it accepts `comparator` which137* is invoked to compare elements of `array` to `values`.138* @param array - The array to inspect139* @param values - The values to exclude140* @param comparator - The comparator invoked per element141* @returns Returns the new array of filtered values142*/143function differenceWith<T>(144array: T[],145values: T[],146comparator?: (arrVal: T, othVal: T) => boolean147): T[];148```149150### Drop151152Creates a slice of array with n elements dropped from the beginning.153154```javascript { .api }155/**156* Creates a slice of `array` with `n` elements dropped from the beginning.157* @param array - The array to query158* @param n - The number of elements to drop (defaults to 1)159* @returns Returns the slice of `array`160*/161function drop<T>(array: T[], n?: number): T[];162```163164### Drop Right165166Creates a slice of array with n elements dropped from the end.167168```javascript { .api }169/**170* Creates a slice of `array` with `n` elements dropped from the end.171* @param array - The array to query172* @param n - The number of elements to drop (defaults to 1)173* @returns Returns the slice of `array`174*/175function dropRight<T>(array: T[], n?: number): T[];176```177178### Drop Right While179180Creates a slice of array excluding elements dropped from the end while predicate returns truthy.181182```javascript { .api }183/**184* Creates a slice of `array` excluding elements dropped from the end.185* Elements are dropped until `predicate` returns falsey.186* @param array - The array to query187* @param predicate - The function invoked per iteration188* @returns Returns the slice of `array`189*/190function dropRightWhile<T>(191array: T[],192predicate?: string | object | ((value: T, index: number, array: T[]) => boolean)193): T[];194```195196### Drop While197198Creates a slice of array excluding elements dropped from the beginning while predicate returns truthy.199200```javascript { .api }201/**202* Creates a slice of `array` excluding elements dropped from the beginning.203* Elements are dropped until `predicate` returns falsey.204* @param array - The array to query205* @param predicate - The function invoked per iteration206* @returns Returns the slice of `array`207*/208function dropWhile<T>(209array: T[],210predicate?: string | object | ((value: T, index: number, array: T[]) => boolean)211): T[];212```213214### Fill215216Fills elements of array with value from start up to, but not including, end.217218```javascript { .api }219/**220* Fills elements of `array` with `value` from `start` up to, but not221* including, `end`.222* @param array - The array to fill223* @param value - The value to fill `array` with224* @param start - The start position (defaults to 0)225* @param end - The end position (defaults to array.length)226* @returns Returns `array`227*/228function fill<T, U>(array: T[], value: U, start?: number, end?: number): (T | U)[];229```230231### Find Index232233Finds the index of the first element predicate returns truthy for.234235```javascript { .api }236/**237* This method is like `find` except that it returns the index of the first238* element `predicate` returns truthy for instead of the element itself.239* @param array - The array to inspect240* @param predicate - The function invoked per iteration241* @param fromIndex - The index to search from (defaults to 0)242* @returns Returns the index of the found element, else -1243*/244function findIndex<T>(245array: T[],246predicate?: string | object | ((value: T, index: number, array: T[]) => boolean),247fromIndex?: number248): number;249```250251### Find Last Index252253Like `findIndex` except that it iterates over elements from right to left.254255```javascript { .api }256/**257* This method is like `findIndex` except that it iterates over elements258* of `collection` from right to left.259* @param array - The array to inspect260* @param predicate - The function invoked per iteration261* @param fromIndex - The index to search from (defaults to array.length - 1)262* @returns Returns the index of the found element, else -1263*/264function findLastIndex<T>(265array: T[],266predicate?: string | object | ((value: T, index: number, array: T[]) => boolean),267fromIndex?: number268): number;269```270271### Flatten272273Flattens array a single level deep.274275```javascript { .api }276/**277* Flattens `array` a single level deep.278* @param array - The array to flatten279* @returns Returns the new flattened array280*/281function flatten<T>(array: T[] | T[][]): T[];282```283284### Flatten Deep285286Recursively flattens array.287288```javascript { .api }289/**290* Recursively flattens `array`.291* @param array - The array to flatten292* @returns Returns the new flattened array293*/294function flattenDeep<T>(array: any[]): T[];295```296297### Flatten Depth298299Recursively flatten array up to depth times.300301```javascript { .api }302/**303* Recursively flatten `array` up to `depth` times.304* @param array - The array to flatten305* @param depth - The maximum recursion depth (defaults to 1)306* @returns Returns the new flattened array307*/308function flattenDepth<T>(array: any[], depth?: number): T[];309```310311### From Pairs312313Returns an object composed from key-value pairs.314315```javascript { .api }316/**317* Returns an object composed from key-value `pairs`.318* @param pairs - The key-value pairs319* @returns Returns the new object320*/321function fromPairs<T>(pairs: Array<[PropertyKey, T]>): Record<string, T>;322```323324### Head325326Gets the first element of array.327328```javascript { .api }329/**330* Gets the first element of `array`.331* @param array - The array to query332* @returns Returns the first element of `array`333*/334function head<T>(array: T[]): T | undefined;335```336337### Index Of338339Gets the index at which the first occurrence of value is found in array.340341```javascript { .api }342/**343* Gets the index at which the first occurrence of `value` is found in `array`344* using SameValueZero for equality comparisons.345* @param array - The array to inspect346* @param value - The value to search for347* @param fromIndex - The index to search from (defaults to 0)348* @returns Returns the index of the matched value, else -1349*/350function indexOf<T>(array: T[], value: T, fromIndex?: number): number;351```352353### Initial354355Gets all but the last element of array.356357```javascript { .api }358/**359* Gets all but the last element of `array`.360* @param array - The array to query361* @returns Returns the slice of `array`362*/363function initial<T>(array: T[]): T[];364```365366### Intersection367368Creates an array of unique values that are included in all given arrays.369370```javascript { .api }371/**372* Creates an array of unique values that are included in all given arrays373* using SameValueZero for equality comparisons.374* @param arrays - The arrays to inspect375* @returns Returns the new array of intersecting values376*/377function intersection<T>(...arrays: T[][]): T[];378```379380### Intersection By381382Like `intersection` except that it accepts `iteratee` which is invoked for each element to generate the criterion by which they're compared.383384```javascript { .api }385/**386* This method is like `intersection` except that it accepts `iteratee`387* which is invoked for each element of each `arrays` to generate the criterion388* by which they're compared.389* @param arrays - The arrays to inspect390* @param iteratee - The iteratee invoked per element391* @returns Returns the new array of intersecting values392*/393function intersectionBy<T>(394array: T[],395...args: Array<T[] | string | ((value: T) => any)>396): T[];397```398399### Intersection With400401Like `intersection` except that it accepts `comparator` which is invoked to compare elements.402403```javascript { .api }404/**405* This method is like `intersection` except that it accepts `comparator`406* which is invoked to compare elements of `arrays`.407* @param arrays - The arrays to inspect408* @param comparator - The comparator invoked per element409* @returns Returns the new array of intersecting values410*/411function intersectionWith<T>(412array: T[],413...args: Array<T[] | ((arrVal: T, othVal: T) => boolean)>414): T[];415```416417### Join418419Converts all elements in array into a string separated by separator.420421```javascript { .api }422/**423* Converts all elements in `array` into a string separated by `separator`.424* @param array - The array to convert425* @param separator - The element separator (defaults to ',')426* @returns Returns the joined string427*/428function join<T>(array: T[], separator?: string): string;429```430431### Last432433Gets the last element of array.434435```javascript { .api }436/**437* Gets the last element of `array`.438* @param array - The array to query439* @returns Returns the last element of `array`440*/441function last<T>(array: T[]): T | undefined;442```443444### Last Index Of445446Gets the index at which the last occurrence of value is found in array.447448```javascript { .api }449/**450* This method is like `indexOf` except that it iterates over elements of451* `array` from right to left.452* @param array - The array to inspect453* @param value - The value to search for454* @param fromIndex - The index to search from (defaults to array.length - 1)455* @returns Returns the index of the matched value, else -1456*/457function lastIndexOf<T>(array: T[], value: T, fromIndex?: number): number;458```459460### Pull461462Removes all given values from array using SameValueZero for equality comparisons.463464```javascript { .api }465/**466* Removes all given values from `array` using SameValueZero for equality comparisons.467* @param array - The array to modify468* @param values - The values to remove469* @returns Returns `array`470*/471function pull<T>(array: T[], ...values: T[]): T[];472```473474### Pull All475476Like `pull` except that it accepts an array of values to remove.477478```javascript { .api }479/**480* This method is like `pull` except that it accepts an array of values to remove.481* @param array - The array to modify482* @param values - The values to remove483* @returns Returns `array`484*/485function pullAll<T>(array: T[], values: T[]): T[];486```487488### Pull All By489490Like `pullAll` except that it accepts `iteratee` which is invoked for each element to generate the criterion by which they're compared.491492```javascript { .api }493/**494* This method is like `pullAll` except that it accepts `iteratee` which is495* invoked for each element of `array` and `values` to generate the criterion496* by which they're compared.497* @param array - The array to modify498* @param values - The values to remove499* @param iteratee - The iteratee invoked per element500* @returns Returns `array`501*/502function pullAllBy<T>(503array: T[],504values: T[],505iteratee?: string | ((value: T) => any)506): T[];507```508509### Pull All With510511Like `pullAll` except that it accepts `comparator` which is invoked to compare elements.512513```javascript { .api }514/**515* This method is like `pullAll` except that it accepts `comparator` which516* is invoked to compare elements of `array` to `values`.517* @param array - The array to modify518* @param values - The values to remove519* @param comparator - The comparator invoked per element520* @returns Returns `array`521*/522function pullAllWith<T>(523array: T[],524values: T[],525comparator?: (arrVal: T, othVal: T) => boolean526): T[];527```528529### Pull At530531Removes elements from array corresponding to indexes and returns an array of removed elements.532533```javascript { .api }534/**535* Removes elements from `array` corresponding to `indexes` and returns an536* array of removed elements.537* @param array - The array to modify538* @param indexes - The indexes of elements to remove539* @returns Returns the new array of removed elements540*/541function pullAt<T>(array: T[], ...indexes: number[]): T[];542```543544### Remove545546Removes all elements from array that predicate returns truthy for and returns an array of the removed elements.547548```javascript { .api }549/**550* Removes all elements from `array` that `predicate` returns truthy for551* and returns an array of the removed elements.552* @param array - The array to modify553* @param predicate - The function invoked per iteration554* @returns Returns the new array of removed elements555*/556function remove<T>(557array: T[],558predicate: string | object | ((value: T, index: number, array: T[]) => boolean)559): T[];560```561562### Reverse563564Reverses array so that the first element becomes the last, the second element becomes the second to last, and so on.565566```javascript { .api }567/**568* Reverses `array` so that the first element becomes the last, the second569* element becomes the second to last, and so on.570* @param array - The array to modify571* @returns Returns `array`572*/573function reverse<T>(array: T[]): T[];574```575576### Slice577578Creates a slice of array from start up to, but not including, end.579580```javascript { .api }581/**582* Creates a slice of `array` from `start` up to, but not including, `end`.583* @param array - The array to slice584* @param start - The start position (defaults to 0)585* @param end - The end position (defaults to array.length)586* @returns Returns the slice of `array`587*/588function slice<T>(array: T[], start?: number, end?: number): T[];589```590591### Sorted Index592593Uses a binary search to determine the lowest index at which value should be inserted into array in order to maintain its sort order.594595```javascript { .api }596/**597* Uses a binary search to determine the lowest index at which `value`598* should be inserted into `array` in order to maintain its sort order.599* @param array - The sorted array to inspect600* @param value - The value to evaluate601* @returns Returns the index at which `value` should be inserted602*/603function sortedIndex<T>(array: T[], value: T): number;604```605606### Sorted Index By607608Like `sortedIndex` except that it accepts `iteratee` which is invoked for `value` and each element of `array` to compute their sort ranking.609610```javascript { .api }611/**612* This method is like `sortedIndex` except that it accepts `iteratee`613* which is invoked for `value` and each element of `array` to compute their614* sort ranking.615* @param array - The sorted array to inspect616* @param value - The value to evaluate617* @param iteratee - The iteratee invoked per element618* @returns Returns the index at which `value` should be inserted619*/620function sortedIndexBy<T>(621array: T[],622value: T,623iteratee?: string | ((value: T) => any)624): number;625```626627### Sorted Index Of628629Performs a binary search on a sorted array to find the index of the first occurrence of a value.630631```javascript { .api }632/**633* This method is like `indexOf` except that it performs a binary search634* on a sorted `array`.635* @param array - The array to inspect636* @param value - The value to search for637* @returns Returns the index of the matched value, else -1638*/639function sortedIndexOf<T>(array: T[], value: T): number;640```641642### Sorted Last Index643644Uses a binary search to determine the highest index at which value should be inserted into array in order to maintain its sort order.645646```javascript { .api }647/**648* This method is like `sortedIndex` except that it returns the highest649* index at which `value` should be inserted into `array` in order to650* maintain its sort order.651* @param array - The sorted array to inspect652* @param value - The value to evaluate653* @returns Returns the index at which `value` should be inserted654*/655function sortedLastIndex<T>(array: T[], value: T): number;656```657658### Sorted Last Index By659660Like `sortedLastIndex` except that it accepts `iteratee` which is invoked for `value` and each element of `array` to compute their sort ranking.661662```javascript { .api }663/**664* This method is like `sortedLastIndex` except that it accepts `iteratee`665* which is invoked for `value` and each element of `array` to compute their666* sort ranking.667* @param array - The sorted array to inspect668* @param value - The value to evaluate669* @param iteratee - The iteratee invoked per element670* @returns Returns the index at which `value` should be inserted671*/672function sortedLastIndexBy<T>(673array: T[],674value: T,675iteratee?: string | ((value: T) => any)676): number;677```678679### Sorted Last Index Of680681Performs a binary search on a sorted array to find the index of the last occurrence of a value.682683```javascript { .api }684/**685* This method is like `lastIndexOf` except that it performs a binary686* search on a sorted `array`.687* @param array - The array to inspect688* @param value - The value to search for689* @returns Returns the index of the matched value, else -1690*/691function sortedLastIndexOf<T>(array: T[], value: T): number;692```693694### Sorted Uniq695696Creates a duplicate-free version of an array, using SameValueZero for equality comparisons, in which only the first occurrence of each element is kept. The order of result values is determined by the order they occur in the array.697698```javascript { .api }699/**700* This method is like `uniq` except that it's designed and optimized701* for sorted arrays.702* @param array - The array to inspect703* @returns Returns the new duplicate free array704*/705function sortedUniq<T>(array: T[]): T[];706```707708### Sorted Uniq By709710Like `sortedUniq` except that it accepts `iteratee` which is invoked for each element to generate the criterion by which uniqueness is computed.711712```javascript { .api }713/**714* This method is like `uniqBy` except that it's designed and optimized715* for sorted arrays.716* @param array - The array to inspect717* @param iteratee - The iteratee invoked per element718* @returns Returns the new duplicate free array719*/720function sortedUniqBy<T>(721array: T[],722iteratee: string | ((value: T) => any)723): T[];724```725726### Tail727728Gets all but the first element of array.729730```javascript { .api }731/**732* Gets all but the first element of `array`.733* @param array - The array to query734* @returns Returns the slice of `array`735*/736function tail<T>(array: T[]): T[];737```738739### Take740741Creates a slice of array with n elements taken from the beginning.742743```javascript { .api }744/**745* Creates a slice of `array` with `n` elements taken from the beginning.746* @param array - The array to query747* @param n - The number of elements to take (defaults to 1)748* @returns Returns the slice of `array`749*/750function take<T>(array: T[], n?: number): T[];751```752753### Take Right754755Creates a slice of array with n elements taken from the end.756757```javascript { .api }758/**759* Creates a slice of `array` with `n` elements taken from the end.760* @param array - The array to query761* @param n - The number of elements to take (defaults to 1)762* @returns Returns the slice of `array`763*/764function takeRight<T>(array: T[], n?: number): T[];765```766767### Take Right While768769Creates a slice of array with elements taken from the end while predicate returns truthy.770771```javascript { .api }772/**773* Creates a slice of `array` with elements taken from the end. Elements are774* taken until `predicate` returns falsey.775* @param array - The array to query776* @param predicate - The function invoked per iteration777* @returns Returns the slice of `array`778*/779function takeRightWhile<T>(780array: T[],781predicate?: string | object | ((value: T, index: number, array: T[]) => boolean)782): T[];783```784785### Take While786787Creates a slice of array with elements taken from the beginning while predicate returns truthy.788789```javascript { .api }790/**791* Creates a slice of `array` with elements taken from the beginning. Elements792* are taken until `predicate` returns falsey.793* @param array - The array to query794* @param predicate - The function invoked per iteration795* @returns Returns the slice of `array`796*/797function takeWhile<T>(798array: T[],799predicate?: string | object | ((value: T, index: number, array: T[]) => boolean)800): T[];801```802803### Union804805Creates an array of unique values, in order, from all given arrays using SameValueZero for equality comparisons.806807```javascript { .api }808/**809* Creates an array of unique values, in order, from all given arrays using810* SameValueZero for equality comparisons.811* @param arrays - The arrays to inspect812* @returns Returns the new array of combined values813*/814function union<T>(...arrays: T[][]): T[];815```816817### Union By818819Like `union` except that it accepts `iteratee` which is invoked for each element to generate the criterion by which uniqueness is computed.820821```javascript { .api }822/**823* This method is like `union` except that it accepts `iteratee` which is824* invoked for each element of each `arrays` to generate the criterion by825* which uniqueness is computed.826* @param arrays - The arrays to inspect827* @param iteratee - The iteratee invoked per element828* @returns Returns the new array of combined values829*/830function unionBy<T>(831array: T[],832...args: Array<T[] | string | ((value: T) => any)>833): T[];834```835836### Union With837838Like `union` except that it accepts `comparator` which is invoked to compare elements.839840```javascript { .api }841/**842* This method is like `union` except that it accepts `comparator` which843* is invoked to compare elements of `arrays`.844* @param arrays - The arrays to inspect845* @param comparator - The comparator invoked per element846* @returns Returns the new array of combined values847*/848function unionWith<T>(849array: T[],850...args: Array<T[] | ((arrVal: T, othVal: T) => boolean)>851): T[];852```853854### Uniq855856Creates a duplicate-free version of an array using SameValueZero for equality comparisons.857858```javascript { .api }859/**860* Creates a duplicate-free version of an array, using SameValueZero for861* equality comparisons, in which only the first occurrence of each element862* is kept. The order of result values is determined by the order they occur863* in the array.864* @param array - The array to inspect865* @returns Returns the new duplicate free array866*/867function uniq<T>(array: T[]): T[];868```869870### Uniq By871872Like `uniq` except that it accepts `iteratee` which is invoked for each element to generate the criterion by which uniqueness is computed.873874```javascript { .api }875/**876* This method is like `uniq` except that it accepts `iteratee` which is877* invoked for each element in `array` to generate the criterion by which878* uniqueness is computed.879* @param array - The array to inspect880* @param iteratee - The iteratee invoked per element881* @returns Returns the new duplicate free array882*/883function uniqBy<T>(884array: T[],885iteratee: string | ((value: T) => any)886): T[];887```888889### Uniq With890891Like `uniq` except that it accepts `comparator` which is invoked to compare elements.892893```javascript { .api }894/**895* This method is like `uniq` except that it accepts `comparator` which896* is invoked to compare elements of `array`.897* @param array - The array to inspect898* @param comparator - The comparator invoked per element899* @returns Returns the new duplicate free array900*/901function uniqWith<T>(902array: T[],903comparator?: (arrVal: T, othVal: T) => boolean904): T[];905```906907### Unzip908909Accepts an array of grouped elements and creates an array regrouping the elements to their pre-zip configuration.910911```javascript { .api }912/**913* This method is like `zip` except that it accepts an array of grouped914* elements and creates an array regrouping the elements to their pre-zip915* configuration.916* @param array - The array of grouped elements to process917* @returns Returns the new array of regrouped elements918*/919function unzip<T>(array: T[][]): T[][];920```921922### Unzip With923924Like `unzip` except that it accepts `iteratee` to specify how regrouped values should be combined.925926```javascript { .api }927/**928* This method is like `unzip` except that it accepts `iteratee` to specify929* how regrouped values should be combined.930* @param array - The array of grouped elements to process931* @param iteratee - The function to combine regrouped values932* @returns Returns the new array of regrouped elements933*/934function unzipWith<T, R>(935array: T[][],936iteratee?: (...values: T[]) => R937): R[];938```939940### Without941942Creates an array excluding all given values using SameValueZero for equality comparisons.943944```javascript { .api }945/**946* Creates an array excluding all given values using SameValueZero for947* equality comparisons.948* @param array - The array to inspect949* @param values - The values to exclude950* @returns Returns the new array of filtered values951*/952function without<T>(array: T[], ...values: T[]): T[];953```954955### Xor956957Creates an array of unique values that is the symmetric difference of the given arrays.958959```javascript { .api }960/**961* Creates an array of unique values that is the symmetric difference of962* the given arrays. The order of result values is determined by the order963* they occur in the arrays.964* @param arrays - The arrays to inspect965* @returns Returns the new array of filtered values966*/967function xor<T>(...arrays: T[][]): T[];968```969970### Xor By971972Like `xor` except that it accepts `iteratee` which is invoked for each element to generate the criterion by which they're compared.973974```javascript { .api }975/**976* This method is like `xor` except that it accepts `iteratee` which is977* invoked for each element of each `arrays` to generate the criterion by978* which by which they're compared.979* @param arrays - The arrays to inspect980* @param iteratee - The iteratee invoked per element981* @returns Returns the new array of filtered values982*/983function xorBy<T>(984array: T[],985...args: Array<T[] | string | ((value: T) => any)>986): T[];987```988989### Xor With990991Like `xor` except that it accepts `comparator` which is invoked to compare elements.992993```javascript { .api }994/**995* This method is like `xor` except that it accepts `comparator` which is996* invoked to compare elements of `arrays`.997* @param arrays - The arrays to inspect998* @param comparator - The comparator invoked per element999* @returns Returns the new array of filtered values1000*/1001function xorWith<T>(1002array: T[],1003...args: Array<T[] | ((arrVal: T, othVal: T) => boolean)>1004): T[];1005```10061007### Zip10081009Creates an array of grouped elements, the first of which contains the first elements of the given arrays, the second of which contains the second elements of the given arrays, and so on.10101011```javascript { .api }1012/**1013* Creates an array of grouped elements, the first of which contains the1014* first elements of the given arrays, the second of which contains the1015* second elements of the given arrays, and so on.1016* @param arrays - The arrays to process1017* @returns Returns the new array of grouped elements1018*/1019function zip<T>(...arrays: T[][]): T[][];1020```10211022### Zip Object10231024Creates an object composed from arrays of keys and values.10251026```javascript { .api }1027/**1028* This method is like `fromPairs` except that it accepts two arrays,1029* one of property identifiers and one of corresponding values.1030* @param keys - The property identifiers1031* @param values - The property values1032* @returns Returns the new object1033*/1034function zipObject<K extends PropertyKey, V>(keys: K[], values: V[]): Record<K, V>;1035```10361037### Zip Object Deep10381039Like `zipObject` except that it supports property paths.10401041```javascript { .api }1042/**1043* This method is like `zipObject` except that it supports property paths.1044* @param paths - The property identifiers1045* @param values - The property values1046* @returns Returns the new object1047*/1048function zipObjectDeep(paths: string[], values: any[]): any;1049```10501051### Zip With10521053Like `zip` except that it accepts `iteratee` to specify how grouped values should be combined.10541055```javascript { .api }1056/**1057* This method is like `zip` except that it accepts `iteratee` to specify1058* how grouped values should be combined.1059* @param arrays - The arrays to process1060* @param iteratee - The function to combine grouped values1061* @returns Returns the new array of grouped elements1062*/1063function zipWith<T, R>(1064array: T[],1065...args: Array<T[] | ((...values: T[]) => R)>1066): R[];1067```10681069## Types10701071```javascript { .api }1072type PropertyKey = string | number | symbol;1073```10741075## Aliases10761077- `first` → `head`