1 | import _ = require("../index");
|
2 | declare module "../index" {
|
3 | interface LoDashStatic {
|
4 | /**
|
5 | * Creates an array of elements split into groups the length of size. If collection can’t be split evenly, the
|
6 | * final chunk will be the remaining elements.
|
7 | *
|
8 | * @param array The array to process.
|
9 | * @param size The length of each chunk.
|
10 | * @return Returns the new array containing chunks.
|
11 | */
|
12 | chunk<T>(array: List<T> | null | undefined, size?: number): T[][];
|
13 | }
|
14 | interface Collection<T> {
|
15 | /**
|
16 | * @see _.chunk
|
17 | */
|
18 | chunk(size?: number): Collection<T[]>;
|
19 | }
|
20 | interface CollectionChain<T> {
|
21 | /**
|
22 | * @see _.chunk
|
23 | */
|
24 | chunk(size?: number): CollectionChain<T[]>;
|
25 | }
|
26 | interface LoDashStatic {
|
27 | /**
|
28 | * Creates an array with all falsey values removed. The values false, null, 0, 0n, "", undefined, and NaN are
|
29 | * falsey.
|
30 | *
|
31 | * @param array The array to compact.
|
32 | * @return Returns the new array of filtered values.
|
33 | */
|
34 | compact<T>(array: List<T | Falsey> | null | undefined): T[];
|
35 | }
|
36 |
|
37 | type Falsey = null | undefined | false | "" | 0 | 0n;
|
38 | type Truthy<T> = T extends Falsey ? never : T;
|
39 | interface Collection<T> {
|
40 | /**
|
41 | * @see _.compact
|
42 | */
|
43 | compact(): Collection<Truthy<T>>;
|
44 | }
|
45 | interface CollectionChain<T> {
|
46 | /**
|
47 | * @see _.compact
|
48 | */
|
49 | compact(): CollectionChain<Truthy<T>>;
|
50 | }
|
51 | interface LoDashStatic {
|
52 | /**
|
53 | * Creates a new array concatenating `array` with any additional arrays
|
54 | * and/or values.
|
55 | *
|
56 | * @category Array
|
57 | * @param [values] The array values to concatenate.
|
58 | * @returns Returns the new concatenated array.
|
59 | * @example
|
60 | *
|
61 | * var array = [1];
|
62 | * var other = _.concat(array, 2, [3], [[4]]);
|
63 | *
|
64 | * console.log(other);
|
65 | * // => [1, 2, 3, [4]]
|
66 | *
|
67 | * console.log(array);
|
68 | * // => [1]
|
69 | */
|
70 | concat<T>(...values: Array<Many<T>>): T[];
|
71 | }
|
72 | interface Primitive<T> {
|
73 | /**
|
74 | * @see _.concat
|
75 | */
|
76 | concat(...values: Array<Many<T>>): Collection<T>;
|
77 | }
|
78 | interface Collection<T> {
|
79 | /**
|
80 | * @see _.concat
|
81 | */
|
82 | concat(...values: Array<Many<T>>): Collection<T>;
|
83 | }
|
84 | interface Object<T> {
|
85 | /**
|
86 | * @see _.concat
|
87 | */
|
88 | concat(...values: Array<Many<T>>): Collection<T>;
|
89 | }
|
90 | interface PrimitiveChain<T> {
|
91 | /**
|
92 | * @see _.concat
|
93 | */
|
94 | concat(...values: Array<Many<T>>): CollectionChain<T>;
|
95 | }
|
96 | interface CollectionChain<T> {
|
97 | /**
|
98 | * @see _.concat
|
99 | */
|
100 | concat(...values: Array<Many<T>>): CollectionChain<T>;
|
101 | }
|
102 | interface ObjectChain<T> {
|
103 | /**
|
104 | * @see _.concat
|
105 | */
|
106 | concat(...values: Array<Many<T>>): CollectionChain<T>;
|
107 | }
|
108 | interface LoDashStatic {
|
109 | /**
|
110 | * Creates an array of `array` values not included in the other provided arrays using SameValueZero for
|
111 | * equality comparisons. The order and references of result values are determined by the first array.
|
112 | *
|
113 | * @param array The array to inspect.
|
114 | * @param values The arrays of values to exclude.
|
115 | * @return Returns the new array of filtered values.
|
116 | */
|
117 | difference<T>(array: List<T> | null | undefined, ...values: Array<List<T>>): T[];
|
118 | }
|
119 | interface Collection<T> {
|
120 | /**
|
121 | * @see _.difference
|
122 | */
|
123 | difference(...values: Array<List<T>>): Collection<T>;
|
124 | }
|
125 | interface CollectionChain<T> {
|
126 | /**
|
127 | * @see _.difference
|
128 | */
|
129 | difference(...values: Array<List<T>>): CollectionChain<T>;
|
130 | }
|
131 | interface LoDashStatic {
|
132 | /**
|
133 | * This method is like _.difference except that it accepts iteratee which is invoked for each element
|
134 | * of array and values to generate the criterion by which they're compared. The order and references
|
135 | * of result values are determined by the first array. The iteratee is invoked with one argument: (value).
|
136 | *
|
137 | * @param array The array to inspect.
|
138 | * @param values The values to exclude.
|
139 | * @param iteratee The iteratee invoked per element.
|
140 | * @returns Returns the new array of filtered values.
|
141 | */
|
142 | differenceBy<T1, T2>(array: List<T1> | null | undefined, values: List<T2>, iteratee: ValueIteratee<T1 | T2>): T1[];
|
143 | /**
|
144 | * @see _.differenceBy
|
145 | */
|
146 | differenceBy<T1, T2, T3>(array: List<T1> | null | undefined, values1: List<T2>, values2: List<T3>, iteratee: ValueIteratee<T1 | T2 | T3>): T1[];
|
147 | /**
|
148 | * @see _.differenceBy
|
149 | */
|
150 | differenceBy<T1, T2, T3, T4>(array: List<T1> | null | undefined, values1: List<T2>, values2: List<T3>, values3: List<T4>, iteratee: ValueIteratee<T1 | T2 | T3 | T4>): T1[];
|
151 | /**
|
152 | * @see _.differenceBy
|
153 | */
|
154 | differenceBy<T1, T2, T3, T4, T5>(array: List<T1> | null | undefined, values1: List<T2>, values2: List<T3>, values3: List<T4>, values4: List<T5>, iteratee: ValueIteratee<T1 | T2 | T3 | T4 | T5>): T1[];
|
155 | /**
|
156 | * @see _.differenceBy
|
157 | */
|
158 | differenceBy<T1, T2, T3, T4, T5, T6>(array: List<T1> | null | undefined, values1: List<T2>, values2: List<T3>, values3: List<T4>, values4: List<T5>, values5: List<T6>, iteratee: ValueIteratee<T1 | T2 | T3 | T4 | T5 | T6>): T1[];
|
159 | /**
|
160 | * @see _.differenceBy
|
161 | */
|
162 | differenceBy<T1, T2, T3, T4, T5, T6, T7>(array: List<T1> | null | undefined, values1: List<T2>, values2: List<T3>, values3: List<T4>, values4: List<T5>, values5: List<T6>, ...values: Array<List<T7> | ValueIteratee<T1 | T2 | T3 | T4 | T5 | T6 | T7>>): T1[];
|
163 | /**
|
164 | * @see _.differenceBy
|
165 | */
|
166 | differenceBy<T>(array: List<T> | null | undefined, ...values: Array<List<T>>): T[];
|
167 | }
|
168 | interface Collection<T> {
|
169 | /**
|
170 | * @see _.differenceBy
|
171 | */
|
172 | differenceBy<T2>(values1: List<T2>, iteratee?: ValueIteratee<T | T2>): Collection<T>;
|
173 | /**
|
174 | * @see _.differenceBy
|
175 | */
|
176 | differenceBy(...values: Array<List<unknown> | ValueIteratee<T>>): Collection<T>;
|
177 | }
|
178 | interface CollectionChain<T> {
|
179 | /**
|
180 | * @see _.differenceBy
|
181 | */
|
182 | differenceBy<T2>(values1: List<T2>, iteratee?: ValueIteratee<T | T2>): CollectionChain<T>;
|
183 | /**
|
184 | * @see _.differenceBy
|
185 | */
|
186 | differenceBy(...values: Array<List<unknown> | ValueIteratee<T>>): CollectionChain<T>;
|
187 | }
|
188 | interface LoDashStatic {
|
189 | /**
|
190 | * This method is like _.difference except that it accepts comparator which is invoked to compare elements
|
191 | * of array to values. The order and references of result values are determined by the first array. The
|
192 | * comparator is invoked with two arguments: (arrVal, othVal).
|
193 | *
|
194 | * @category Array
|
195 | * @param [values] The arrays to inspect.
|
196 | * @param [comparator] The comparator invoked per element.
|
197 | * @returns Returns the new array of filtered values.
|
198 | * @example
|
199 | *
|
200 | * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
|
201 |
|
202 | * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
|
203 | * // => [{ 'x': 2, 'y': 1 }]
|
204 | */
|
205 | differenceWith<T1, T2>(array: List<T1> | null | undefined, values: List<T2>, comparator: Comparator2<T1, T2>): T1[];
|
206 | /**
|
207 | * @see _.differenceWith
|
208 | */
|
209 | differenceWith<T1, T2, T3>(array: List<T1> | null | undefined, values1: List<T2>, values2: List<T3>, comparator: Comparator2<T1, T2 | T3>): T1[];
|
210 | /**
|
211 | * @see _.differenceWith
|
212 | */
|
213 | differenceWith<T1, T2, T3, T4>(array: List<T1> | null | undefined, values1: List<T2>, values2: List<T3>, ...values: Array<List<T4> | Comparator2<T1, T2 | T3 | T4>>): T1[];
|
214 | /**
|
215 | * @see _.differenceWith
|
216 | */
|
217 | differenceWith<T>(array: List<T> | null | undefined, ...values: Array<List<T>>): T[];
|
218 | }
|
219 | interface Collection<T> {
|
220 | /**
|
221 | * @see _.differenceWith
|
222 | */
|
223 | differenceWith<T2>(values: List<T2>, comparator: Comparator2<T, T2>): Collection<T>;
|
224 | /**
|
225 | * @see _.differenceWith
|
226 | */
|
227 | differenceWith<T2, T3, T4>(...values: Array<List<unknown> | Comparator2<T, never>>): Collection<T>;
|
228 | }
|
229 | interface CollectionChain<T> {
|
230 | /**
|
231 | * @see _.differenceWith
|
232 | */
|
233 | differenceWith< T2>(values: List<T2>, comparator: Comparator2<T, T2>): CollectionChain<T>;
|
234 | /**
|
235 | * @see _.differenceWith
|
236 | */
|
237 | differenceWith< T2, T3, T4>(...values: Array<List<unknown> | Comparator2<T, never>>): CollectionChain<T>;
|
238 | }
|
239 | interface LoDashStatic {
|
240 | /**
|
241 | * Creates a slice of array with n elements dropped from the beginning.
|
242 | *
|
243 | * @param array The array to query.
|
244 | * @param n The number of elements to drop.
|
245 | * @return Returns the slice of array.
|
246 | */
|
247 | drop<T>(array: List<T> | null | undefined, n?: number): T[];
|
248 | }
|
249 | interface Collection<T> {
|
250 | /**
|
251 | * @see _.drop
|
252 | */
|
253 | drop(n?: number): Collection<T>;
|
254 | }
|
255 | interface CollectionChain<T> {
|
256 | /**
|
257 | * @see _.drop
|
258 | */
|
259 | drop(n?: number): CollectionChain<T>;
|
260 | }
|
261 | interface LoDashStatic {
|
262 | /**
|
263 | * Creates a slice of array with n elements dropped from the end.
|
264 | *
|
265 | * @param array The array to query.
|
266 | * @param n The number of elements to drop.
|
267 | * @return Returns the slice of array.
|
268 | */
|
269 | dropRight<T>(array: List<T> | null | undefined, n?: number): T[];
|
270 | }
|
271 | interface Collection<T> {
|
272 | /**
|
273 | * @see _.dropRight
|
274 | */
|
275 | dropRight(n?: number): Collection<T>;
|
276 | }
|
277 | interface CollectionChain<T> {
|
278 | /**
|
279 | * @see _.dropRight
|
280 | */
|
281 | dropRight(n?: number): CollectionChain<T>;
|
282 | }
|
283 | interface LoDashStatic {
|
284 | /**
|
285 | * Creates a slice of array excluding elements dropped from the end. Elements are dropped until predicate
|
286 | * returns falsey. The predicate is invoked with three arguments: (value, index, array).
|
287 | *
|
288 | * @param array The array to query.
|
289 | * @param predicate The function invoked per iteration.
|
290 | * @return Returns the slice of array.
|
291 | */
|
292 | dropRightWhile<T>(array: List<T> | null | undefined, predicate?: ListIteratee<T>): T[];
|
293 | }
|
294 | interface Collection<T> {
|
295 | /**
|
296 | * @see _.dropRightWhile
|
297 | */
|
298 | dropRightWhile(predicate?: ListIteratee<T>): Collection<T>;
|
299 | }
|
300 | interface CollectionChain<T> {
|
301 | /**
|
302 | * @see _.dropRightWhile
|
303 | */
|
304 | dropRightWhile(predicate?: ListIteratee<T>): CollectionChain<T>;
|
305 | }
|
306 | interface LoDashStatic {
|
307 | /**
|
308 | * Creates a slice of array excluding elements dropped from the beginning. Elements are dropped until predicate
|
309 | * returns falsey. The predicate is invoked with three arguments: (value, index, array).
|
310 | *
|
311 | * @param array The array to query.
|
312 | * @param predicate The function invoked per iteration.
|
313 | * @return Returns the slice of array.
|
314 | */
|
315 | dropWhile<T>(array: List<T> | null | undefined, predicate?: ListIteratee<T>): T[];
|
316 | }
|
317 | interface Collection<T> {
|
318 | /**
|
319 | * @see _.dropWhile
|
320 | */
|
321 | dropWhile(predicate?: ListIteratee<T>): Collection<T>;
|
322 | }
|
323 | interface CollectionChain<T> {
|
324 | /**
|
325 | * @see _.dropWhile
|
326 | */
|
327 | dropWhile(predicate?: ListIteratee<T>): CollectionChain<T>;
|
328 | }
|
329 | interface LoDashStatic {
|
330 | /**
|
331 | * Fills elements of array with value from start up to, but not including, end.
|
332 | *
|
333 | * Note: This method mutates array.
|
334 | *
|
335 | * @param array The array to fill.
|
336 | * @param value The value to fill array with.
|
337 | * @param start The start position.
|
338 | * @param end The end position.
|
339 | * @return Returns array.
|
340 | */
|
341 | fill<T>(array: any[] | null | undefined, value: T): T[];
|
342 | /**
|
343 | * @see _.fill
|
344 | */
|
345 | fill<T>(array: List<any> | null | undefined, value: T): List<T>;
|
346 | /**
|
347 | * @see _.fill
|
348 | */
|
349 | fill<T, U>(array: U[] | null | undefined, value: T, start?: number, end?: number): Array<T | U>;
|
350 | /**
|
351 | * @see _.fill
|
352 | */
|
353 | fill<T, U>(array: List<U> | null | undefined, value: T, start?: number, end?: number): List<T | U>;
|
354 | }
|
355 | interface Collection<T> {
|
356 | /**
|
357 | * @see _.fill
|
358 | */
|
359 | fill<U>(value: U, start?: number, end?: number): Collection<T | U>;
|
360 | }
|
361 | interface CollectionChain<T> {
|
362 | /**
|
363 | * @see _.fill
|
364 | */
|
365 | fill<U>(value: U, start?: number, end?: number): CollectionChain<T | U>;
|
366 | }
|
367 | interface LoDashStatic {
|
368 | /**
|
369 | * This method is like _.find except that it returns the index of the first element predicate returns truthy
|
370 | * for instead of the element itself.
|
371 | *
|
372 | * @param array The array to search.
|
373 | * @param predicate The function invoked per iteration.
|
374 | * @param fromIndex The index to search from.
|
375 | * @return Returns the index of the found element, else -1.
|
376 | */
|
377 | findIndex<T>(array: List<T> | null | undefined, predicate?: ListIterateeCustom<T, boolean>, fromIndex?: number): number;
|
378 | }
|
379 | interface Collection<T> {
|
380 | /**
|
381 | * @see _.findIndex
|
382 | */
|
383 | findIndex(predicate?: ListIterateeCustom<T, boolean>, fromIndex?: number): number;
|
384 | }
|
385 | interface CollectionChain<T> {
|
386 | /**
|
387 | * @see _.findIndex
|
388 | */
|
389 | findIndex(predicate?: ListIterateeCustom<T, boolean>, fromIndex?: number): PrimitiveChain<number>;
|
390 | }
|
391 | interface LoDashStatic {
|
392 | /**
|
393 | * This method is like _.findIndex except that it iterates over elements of collection from right to left.
|
394 | *
|
395 | * @param array The array to search.
|
396 | * @param predicate The function invoked per iteration.
|
397 | * @param fromIndex The index to search from.
|
398 | * @return Returns the index of the found element, else -1.
|
399 | */
|
400 | findLastIndex<T>(array: List<T> | null | undefined, predicate?: ListIterateeCustom<T, boolean>, fromIndex?: number): number;
|
401 | }
|
402 | interface Collection<T> {
|
403 | /**
|
404 | * @see _.findLastIndex
|
405 | */
|
406 | findLastIndex(predicate?: ListIterateeCustom<T, boolean>, fromIndex?: number): number;
|
407 | }
|
408 | interface CollectionChain<T> {
|
409 | /**
|
410 | * @see _.findLastIndex
|
411 | */
|
412 | findLastIndex(predicate?: ListIterateeCustom<T, boolean>, fromIndex?: number): PrimitiveChain<number>;
|
413 | }
|
414 | interface LoDashStatic {
|
415 | /**
|
416 | * @see _.head
|
417 | */
|
418 | first: LoDashStatic["head"];
|
419 | }
|
420 | interface String {
|
421 | /**
|
422 | * @see _.first
|
423 | */
|
424 | first(): string | undefined;
|
425 | }
|
426 | interface StringChain {
|
427 | /**
|
428 | * @see _.first
|
429 | */
|
430 | first(): StringNullableChain;
|
431 | }
|
432 | interface StringNullableChain {
|
433 | /**
|
434 | * @see _.first
|
435 | */
|
436 | first(): StringNullableChain;
|
437 | }
|
438 | interface Collection<T> {
|
439 | /**
|
440 | * @see _.first
|
441 | */
|
442 | first(): T | undefined;
|
443 | }
|
444 | interface CollectionChain<T> {
|
445 | /**
|
446 | * @see _.first
|
447 | */
|
448 | first(): ExpChain<T | undefined>;
|
449 | }
|
450 | interface RecursiveArray<T> extends Array<T|RecursiveArray<T>> {}
|
451 | interface ListOfRecursiveArraysOrValues<T> extends List<T|RecursiveArray<T>> {}
|
452 | interface LoDashStatic {
|
453 | /**
|
454 | * Flattens `array` a single level deep.
|
455 | *
|
456 | * @param array The array to flatten.
|
457 | * @return Returns the new flattened array.
|
458 | */
|
459 | flatten<T>(array: List<Many<T>> | null | undefined): T[];
|
460 | }
|
461 | interface String {
|
462 | /**
|
463 | * @see _.flatten
|
464 | */
|
465 | flatten(): Collection<string>;
|
466 | }
|
467 | interface StringChain {
|
468 | /**
|
469 | * @see _.flatten
|
470 | */
|
471 | flatten(): CollectionChain<string>;
|
472 | }
|
473 | interface StringNullableChain {
|
474 | /**
|
475 | * @see _.flatten
|
476 | */
|
477 | flatten(): CollectionChain<string>;
|
478 | }
|
479 | interface Collection<T> {
|
480 | /**
|
481 | * @see _.flatten
|
482 | */
|
483 | flatten(): T extends Many<infer U> ? Collection<U> : Collection<T>;
|
484 | }
|
485 | interface CollectionChain<T> {
|
486 | /**
|
487 | * @see _.flatten
|
488 | */
|
489 | flatten(): T extends Many<infer U> ? CollectionChain<U> : CollectionChain<T>;
|
490 | }
|
491 |
|
492 | type Flat<T> = T extends string ? T : (T extends List<any> ? never : T);
|
493 |
|
494 | interface LoDashStatic {
|
495 | /**
|
496 | * Recursively flattens a nested array.
|
497 | *
|
498 | * @param array The array to recursively flatten.
|
499 | * @return Returns the new flattened array.
|
500 | */
|
501 | flattenDeep<T>(array: ListOfRecursiveArraysOrValues<T> | null | undefined): Array<Flat<T>>;
|
502 | }
|
503 | interface Collection<T> {
|
504 | /**
|
505 | * @see _.flattenDeep
|
506 | */
|
507 | flattenDeep(): T extends ListOfRecursiveArraysOrValues<infer U> ? Collection<Flat<U>> : Collection<T>;
|
508 | }
|
509 | interface CollectionChain<T> {
|
510 | /**
|
511 | * @see _.flattenDeep
|
512 | */
|
513 | flattenDeep(): T extends ListOfRecursiveArraysOrValues<infer U> ? CollectionChain<Flat<U>> : CollectionChain<T>;
|
514 | }
|
515 | interface LoDashStatic {
|
516 | /**
|
517 | * Recursively flatten array up to depth times.
|
518 | *
|
519 | * @param array The array to recursively flatten.
|
520 | * @param number The maximum recursion depth.
|
521 | * @return Returns the new flattened array.
|
522 | */
|
523 | flattenDepth<T>(array: ListOfRecursiveArraysOrValues<T> | null | undefined, depth?: number): T[];
|
524 | }
|
525 | interface Collection<T> {
|
526 | /**
|
527 | * @see _.flattenDepth
|
528 | */
|
529 | flattenDepth(depth?: number): Collection<T>;
|
530 | }
|
531 | interface CollectionChain<T> {
|
532 | /**
|
533 | * @see _.flattenDepth
|
534 | */
|
535 | flattenDepth(depth?: number): CollectionChain<T>;
|
536 | }
|
537 | interface LoDashStatic {
|
538 | /**
|
539 | * The inverse of `_.toPairs`; this method returns an object composed
|
540 | * from key-value `pairs`.
|
541 | *
|
542 | * @category Array
|
543 | * @param pairs The key-value pairs.
|
544 | * @returns Returns the new object.
|
545 | * @example
|
546 | *
|
547 | * _.fromPairs([['fred', 30], ['barney', 40]]);
|
548 | * // => { 'fred': 30, 'barney': 40 }
|
549 | */
|
550 | fromPairs<T>(pairs: List<[PropertyName, T]> | null | undefined): Dictionary<T>;
|
551 | /**
|
552 | * @see _.fromPairs
|
553 | */
|
554 | fromPairs(pairs: List<any[]> | null | undefined): Dictionary<any>;
|
555 | }
|
556 | interface Collection<T> {
|
557 | /**
|
558 | * @see _.fromPairs
|
559 | */
|
560 | fromPairs(): Object<Dictionary<T extends [PropertyName, infer U] ? U : any>>;
|
561 | }
|
562 | interface CollectionChain<T> {
|
563 | /**
|
564 | * @see _.fromPairs
|
565 | */
|
566 | fromPairs(): ObjectChain<Dictionary<T extends [PropertyName, infer U] ? U : any>>;
|
567 | }
|
568 | interface LoDashStatic {
|
569 | /**
|
570 | * Gets the first element of array.
|
571 | *
|
572 | * @alias _.first
|
573 | *
|
574 | * @param array The array to query.
|
575 | * @return Returns the first element of array.
|
576 | */
|
577 | head<T>(array: readonly [T, ...unknown[]]): T;
|
578 | head<T>(array: List<T> | null | undefined): T | undefined;
|
579 | }
|
580 | interface String {
|
581 | /**
|
582 | * @see _.head
|
583 | */
|
584 | head(): string | undefined;
|
585 | }
|
586 | interface StringChain {
|
587 | /**
|
588 | * @see _.head
|
589 | */
|
590 | head(): StringNullableChain;
|
591 | }
|
592 | interface StringNullableChain {
|
593 | /**
|
594 | * @see _.head
|
595 | */
|
596 | head(): StringNullableChain;
|
597 | }
|
598 | interface Collection<T> {
|
599 | /**
|
600 | * @see _.head
|
601 | */
|
602 | head(): T | undefined;
|
603 | }
|
604 | interface CollectionChain<T> {
|
605 | /**
|
606 | * @see _.head
|
607 | */
|
608 | head(): ExpChain<T | undefined>;
|
609 | }
|
610 | interface LoDashStatic {
|
611 | /**
|
612 | * Gets the index at which the first occurrence of `value` is found in `array`
|
613 | * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
614 | * for equality comparisons. If `fromIndex` is negative, it's used as the offset
|
615 | * from the end of `array`.
|
616 | *
|
617 | * @category Array
|
618 | * @param array The array to search.
|
619 | * @param value The value to search for.
|
620 | * @param [fromIndex=0] The index to search from.
|
621 | * @returns Returns the index of the matched value, else `-1`.
|
622 | * @example
|
623 | *
|
624 | * _.indexOf([1, 2, 1, 2], 2);
|
625 | * // => 1
|
626 | *
|
627 | * // using `fromIndex`
|
628 | * _.indexOf([1, 2, 1, 2], 2, 2);
|
629 | * // => 3
|
630 | */
|
631 | indexOf<T>(array: List<T> | null | undefined, value: T, fromIndex?: number): number;
|
632 | }
|
633 | interface Collection<T> {
|
634 | /**
|
635 | * @see _.indexOf
|
636 | */
|
637 | indexOf(value: T, fromIndex?: number): number;
|
638 | }
|
639 | interface CollectionChain<T> {
|
640 | /**
|
641 | * @see _.indexOf
|
642 | */
|
643 | indexOf(value: T, fromIndex?: number): PrimitiveChain<number>;
|
644 | }
|
645 | interface LoDashStatic {
|
646 | /**
|
647 | * Gets all but the last element of array.
|
648 | *
|
649 | * @param array The array to query.
|
650 | * @return Returns the slice of array.
|
651 | */
|
652 | initial<T>(array: List<T> | null | undefined): T[];
|
653 | }
|
654 | interface Collection<T> {
|
655 | /**
|
656 | * @see _.initial
|
657 | */
|
658 | initial(): Collection<T>;
|
659 | }
|
660 | interface CollectionChain<T> {
|
661 | /**
|
662 | * @see _.initial
|
663 | */
|
664 | initial(): CollectionChain<T>;
|
665 | }
|
666 | interface LoDashStatic {
|
667 | /**
|
668 | * Creates an array of unique values that are included in all of the provided arrays using SameValueZero for
|
669 | * equality comparisons.
|
670 | *
|
671 | * @param arrays The arrays to inspect.
|
672 | * @return Returns the new array of shared values.
|
673 | */
|
674 | intersection<T>(...arrays: Array<List<T> | null | undefined>): T[];
|
675 | }
|
676 | interface Collection<T> {
|
677 | /**
|
678 | * @see _.intersection
|
679 | */
|
680 | intersection(...arrays: Array<List<T> | null | undefined>): Collection<T>;
|
681 | }
|
682 | interface CollectionChain<T> {
|
683 | /**
|
684 | * @see _.intersection
|
685 | */
|
686 | intersection(...arrays: Array<List<T> | null | undefined>): CollectionChain<T>;
|
687 | }
|
688 | interface LoDashStatic {
|
689 | /**
|
690 | * This method is like `_.intersection` except that it accepts `iteratee`
|
691 | * which is invoked for each element of each `arrays` to generate the criterion
|
692 | * by which uniqueness is computed. The iteratee is invoked with one argument: (value).
|
693 | *
|
694 | * @category Array
|
695 | * @param [arrays] The arrays to inspect.
|
696 | * @param [iteratee=_.identity] The iteratee invoked per element.
|
697 | * @returns Returns the new array of shared values.
|
698 | * @example
|
699 | *
|
700 | * _.intersectionBy([2.1, 1.2], [4.3, 2.4], Math.floor);
|
701 | * // => [2.1]
|
702 | *
|
703 | * // using the `_.property` iteratee shorthand
|
704 | * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
|
705 | * // => [{ 'x': 1 }]
|
706 | */
|
707 | intersectionBy<T1, T2>(array: List<T1> | null, values: List<T2>, iteratee: ValueIteratee<T1 | T2>): T1[];
|
708 | /**
|
709 | * @see _.intersectionBy
|
710 | */
|
711 | intersectionBy<T1, T2, T3>(array: List<T1> | null, values1: List<T2>, values2: List<T3>, iteratee: ValueIteratee<T1 | T2 | T3>): T1[];
|
712 | /**
|
713 | * @see _.intersectionBy
|
714 | */
|
715 | intersectionBy<T1, T2, T3, T4>(array: List<T1> | null | undefined, values1: List<T2>, values2: List<T3>, ...values: Array<List<T4> | ValueIteratee<T1 | T2 | T3 | T4>>): T1[];
|
716 | /**
|
717 | * @see _.intersectionBy
|
718 | */
|
719 | intersectionBy<T>(array?: List<T> | null, ...values: Array<List<T>>): T[];
|
720 | /**
|
721 | * @see _.intersectionBy
|
722 | */
|
723 | intersectionBy<T>(...values: Array<List<T> | ValueIteratee<T>>): T[];
|
724 | }
|
725 | interface Collection<T> {
|
726 | /**
|
727 | * @see _.intersectionBy
|
728 | */
|
729 | intersectionBy<T2>(values: List<T2>, iteratee: ValueIteratee<T | T2>): Collection<T>;
|
730 | /**
|
731 | * @see _.intersectionBy
|
732 | */
|
733 | intersectionBy(...values: Array<List<unknown> | ValueIteratee<T>>): Collection<T>;
|
734 | }
|
735 | interface CollectionChain<T> {
|
736 | /**
|
737 | * @see _.intersectionBy
|
738 | */
|
739 | intersectionBy<T2>(values: List<T2>, iteratee: ValueIteratee<T | T2>): CollectionChain<T>;
|
740 | /**
|
741 | * @see _.intersectionBy
|
742 | */
|
743 | intersectionBy(...values: Array<List<unknown> | ValueIteratee<T>>): CollectionChain<T>;
|
744 | }
|
745 | interface LoDashStatic {
|
746 | /**
|
747 | * Creates an array of unique `array` values not included in the other
|
748 | * provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
749 | * for equality comparisons.
|
750 | *
|
751 | * @category Array
|
752 | * @param [values] The arrays to inspect.
|
753 | * @param [comparator] The comparator invoked per element.
|
754 | * @returns Returns the new array of filtered values.
|
755 | * @example
|
756 | *
|
757 | * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
|
758 | * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
|
759 |
|
760 | * _.intersectionWith(objects, others, _.isEqual);
|
761 | * // => [{ 'x': 1, 'y': 2 }]
|
762 | */
|
763 | intersectionWith<T1, T2>(array: List<T1> | null | undefined, values: List<T2>, comparator: Comparator2<T1, T2>): T1[];
|
764 | /**
|
765 | * @see _.intersectionWith
|
766 | */
|
767 | intersectionWith<T1, T2, T3>(array: List<T1> | null | undefined, values1: List<T2>, values2: List<T3>, comparator: Comparator2<T1, T2 | T3>): T1[];
|
768 | /**
|
769 | * @see _.intersectionWith
|
770 | */
|
771 | intersectionWith<T1, T2, T3, T4>(array: List<T1> | null | undefined, values1: List<T2>, values2: List<T3>, ...values: Array<List<T4> | Comparator2<T1, T2 | T3 | T4>>): T1[];
|
772 | /**
|
773 | * @see _.intersectionWith
|
774 | */
|
775 | intersectionWith<T>(array?: List<T> | null, ...values: Array<List<T> | Comparator2<T, never>>): T[];
|
776 | }
|
777 | interface Collection<T> {
|
778 | /**
|
779 | * @see _.intersectionWith
|
780 | */
|
781 | intersectionWith<T2>(values: List<T2>, comparator: Comparator2<T, T2>): Collection<T>;
|
782 | /**
|
783 | * @see _.intersectionWith
|
784 | */
|
785 | intersectionWith(...values: Array<List<unknown> | Comparator2<T, never>>): Collection<T>;
|
786 | }
|
787 | interface CollectionChain<T> {
|
788 | /**
|
789 | * @see _.intersectionWith
|
790 | */
|
791 | intersectionWith<T2>(values: List<T2>, comparator: Comparator2<T, T2>): CollectionChain<T>;
|
792 | /**
|
793 | * @see _.intersectionWith
|
794 | */
|
795 | intersectionWith(...values: Array<List<unknown> | Comparator2<T, never>>): CollectionChain<T>;
|
796 | }
|
797 | interface LoDashStatic {
|
798 | /**
|
799 | * Converts all elements in `array` into a string separated by `separator`.
|
800 | *
|
801 | * @param array The array to convert.
|
802 | * @param separator The element separator.
|
803 | * @returns Returns the joined string.
|
804 | */
|
805 | join(array: List<any> | null | undefined, separator?: string): string;
|
806 | }
|
807 | interface String {
|
808 | /**
|
809 | * @see _.join
|
810 | */
|
811 | join(separator?: string): string;
|
812 | }
|
813 | interface StringChain {
|
814 | /**
|
815 | * @see _.join
|
816 | */
|
817 | join(separator?: string): StringChain;
|
818 | }
|
819 | interface StringNullableChain {
|
820 | /**
|
821 | * @see _.join
|
822 | */
|
823 | join(separator?: string): StringChain;
|
824 | }
|
825 | interface Collection<T> {
|
826 | /**
|
827 | * @see _.join
|
828 | */
|
829 | join(separator?: string): string;
|
830 | }
|
831 | interface CollectionChain<T> {
|
832 | /**
|
833 | * @see _.join
|
834 | */
|
835 | join(separator?: string): StringChain;
|
836 | }
|
837 | interface LoDashStatic {
|
838 | /**
|
839 | * Gets the last element of array.
|
840 | *
|
841 | * @param array The array to query.
|
842 | * @return Returns the last element of array.
|
843 | */
|
844 | last<T>(array: List<T> | null | undefined): T | undefined;
|
845 | }
|
846 | interface Collection<T> {
|
847 | /**
|
848 | * @see _.last
|
849 | */
|
850 | last(): T | undefined;
|
851 | }
|
852 | interface CollectionChain<T> {
|
853 | /**
|
854 | * @see _.last
|
855 | */
|
856 | last(): ExpChain<T | undefined>;
|
857 | }
|
858 | interface String {
|
859 | /**
|
860 | * @see _.last
|
861 | */
|
862 | last(): string | undefined;
|
863 | }
|
864 | interface StringChain {
|
865 | /**
|
866 | * @see _.last
|
867 | */
|
868 | last(): StringNullableChain;
|
869 | }
|
870 | interface StringNullableChain {
|
871 | /**
|
872 | * @see _.last
|
873 | */
|
874 | last(): StringNullableChain;
|
875 | }
|
876 | interface LoDashStatic {
|
877 | /**
|
878 | * This method is like _.indexOf except that it iterates over elements of array from right to left.
|
879 | *
|
880 | * @param array The array to search.
|
881 | * @param value The value to search for.
|
882 | * @param fromIndex The index to search from or true to perform a binary search on a sorted array.
|
883 | * @return Returns the index of the matched value, else -1.
|
884 | */
|
885 | lastIndexOf<T>(array: List<T> | null | undefined, value: T, fromIndex?: true|number): number;
|
886 | }
|
887 | interface Collection<T> {
|
888 | /**
|
889 | * @see _.lastIndexOf
|
890 | */
|
891 | lastIndexOf(value: T, fromIndex?: true|number): number;
|
892 | }
|
893 | interface CollectionChain<T> {
|
894 | /**
|
895 | * @see _.lastIndexOf
|
896 | */
|
897 | lastIndexOf(value: T, fromIndex?: true|number): PrimitiveChain<number>;
|
898 | }
|
899 | interface LoDashStatic {
|
900 | /**
|
901 | * Gets the element at index `n` of `array`. If `n` is negative, the nth element from the end is returned.
|
902 | *
|
903 | * @param array array The array to query.
|
904 | * @param value The index of the element to return.
|
905 | * @return Returns the nth element of `array`.
|
906 | */
|
907 | nth<T>(array: List<T> | null | undefined, n?: number): T | undefined;
|
908 | }
|
909 | interface Collection<T> {
|
910 | /**
|
911 | * @see _.nth
|
912 | */
|
913 | nth(n?: number): T | undefined;
|
914 | }
|
915 | interface CollectionChain<T> {
|
916 | /**
|
917 | * @see _.nth
|
918 | */
|
919 | nth(n?: number): ExpChain<T | undefined>;
|
920 | }
|
921 | interface LoDashStatic {
|
922 | /**
|
923 | * Removes all provided values from array using SameValueZero for equality comparisons.
|
924 | *
|
925 | * Note: Unlike _.without, this method mutates array.
|
926 | *
|
927 | * @param array The array to modify.
|
928 | * @param values The values to remove.
|
929 | * @return Returns array.
|
930 | */
|
931 | pull<T>(array: T[], ...values: T[]): T[];
|
932 | /**
|
933 | * @see _.pull
|
934 | */
|
935 | pull<T>(array: List<T>, ...values: T[]): List<T>;
|
936 | }
|
937 | interface Collection<T> {
|
938 | /**
|
939 | * @see _.pull
|
940 | */
|
941 | pull(...values: T[]): Collection<T>;
|
942 | }
|
943 | interface CollectionChain<T> {
|
944 | /**
|
945 | * @see _.pull
|
946 | */
|
947 | pull(...values: T[]): CollectionChain<T>;
|
948 | }
|
949 | interface LoDashStatic {
|
950 | /**
|
951 | * This method is like `_.pull` except that it accepts an array of values to remove.
|
952 | *
|
953 | * **Note:** Unlike `_.difference`, this method mutates `array`.
|
954 | *
|
955 | * @category Array
|
956 | * @param array The array to modify.
|
957 | * @param values The values to remove.
|
958 | * @returns Returns `array`.
|
959 | * @example
|
960 | *
|
961 | * var array = [1, 2, 3, 1, 2, 3];
|
962 | *
|
963 | * _.pull(array, [2, 3]);
|
964 | * console.log(array);
|
965 | * // => [1, 1]
|
966 | */
|
967 | pullAll<T>(array: T[], values?: List<T>): T[];
|
968 | /**
|
969 | * @see _.pullAll
|
970 | */
|
971 | pullAll<T>(array: List<T>, values?: List<T>): List<T>;
|
972 | }
|
973 | interface Collection<T> {
|
974 | /**
|
975 | * @see _.pullAll
|
976 | */
|
977 | pullAll(values?: List<T>): Collection<T>;
|
978 | }
|
979 | interface CollectionChain<T> {
|
980 | /**
|
981 | * @see _.pullAll
|
982 | */
|
983 | pullAll(values?: List<T>): CollectionChain<T>;
|
984 | }
|
985 | interface LoDashStatic {
|
986 | /**
|
987 | * This method is like `_.pullAll` except that it accepts `iteratee` which is
|
988 | * invoked for each element of `array` and `values` to to generate the criterion
|
989 | * by which uniqueness is computed. The iteratee is invoked with one argument: (value).
|
990 | *
|
991 | * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
|
992 | *
|
993 | * @category Array
|
994 | * @param array The array to modify.
|
995 | * @param values The values to remove.
|
996 | * @param [iteratee=_.identity] The iteratee invoked per element.
|
997 | * @returns Returns `array`.
|
998 | * @example
|
999 | *
|
1000 | * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
|
1001 | *
|
1002 | * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
|
1003 | * console.log(array);
|
1004 | * // => [{ 'x': 2 }]
|
1005 | */
|
1006 | pullAllBy<T>(array: T[], values?: List<T>, iteratee?: ValueIteratee<T>): T[];
|
1007 | /**
|
1008 | * @see _.pullAllBy
|
1009 | */
|
1010 | pullAllBy<T>(array: List<T>, values?: List<T>, iteratee?: ValueIteratee<T>): List<T>;
|
1011 | /**
|
1012 | * @see _.pullAllBy
|
1013 | */
|
1014 | pullAllBy<T1, T2>(array: T1[], values: List<T2>, iteratee: ValueIteratee<T1 | T2>): T1[];
|
1015 | /**
|
1016 | * @see _.pullAllBy
|
1017 | */
|
1018 | pullAllBy<T1, T2>(array: List<T1>, values: List<T2>, iteratee: ValueIteratee<T1 | T2>): List<T1>;
|
1019 | }
|
1020 | interface Collection<T> {
|
1021 | /**
|
1022 | * @see _.pullAllBy
|
1023 | */
|
1024 | pullAllBy<T2>(values?: List<T2>, iteratee?: ValueIteratee<T | T2>): Collection<T>;
|
1025 | }
|
1026 | interface CollectionChain<T> {
|
1027 | /**
|
1028 | * @see _.pullAllBy
|
1029 | */
|
1030 | pullAllBy<T2>(values?: List<T2>, iteratee?: ValueIteratee<T | T2>): CollectionChain<T>;
|
1031 | }
|
1032 | interface LoDashStatic {
|
1033 | /**
|
1034 | * This method is like `_.pullAll` except that it accepts `comparator` which is
|
1035 | * invoked to compare elements of array to values. The comparator is invoked with
|
1036 | * two arguments: (arrVal, othVal).
|
1037 | *
|
1038 | * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
|
1039 | *
|
1040 | * @category Array
|
1041 | * @param array The array to modify.
|
1042 | * @param values The values to remove.
|
1043 | * @param [iteratee=_.identity] The iteratee invoked per element.
|
1044 | * @returns Returns `array`.
|
1045 | * @example
|
1046 | *
|
1047 | * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
|
1048 | *
|
1049 | * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
|
1050 | * console.log(array);
|
1051 | * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
|
1052 | */
|
1053 | pullAllWith<T>(array: T[], values?: List<T>, comparator?: Comparator<T>): T[];
|
1054 | /**
|
1055 | * @see _.pullAllWith
|
1056 | */
|
1057 | pullAllWith<T>(array: List<T>, values?: List<T>, comparator?: Comparator<T>): List<T>;
|
1058 | /**
|
1059 | * @see _.pullAllWith
|
1060 | */
|
1061 | pullAllWith<T1, T2>(array: T1[], values: List<T2>, comparator: Comparator2<T1, T2>): T1[];
|
1062 | /**
|
1063 | * @see _.pullAllWith
|
1064 | */
|
1065 | pullAllWith<T1, T2>(array: List<T1>, values: List<T2>, comparator: Comparator2<T1, T2>): List<T1>;
|
1066 | }
|
1067 | interface Collection<T> {
|
1068 | /**
|
1069 | * @see _.pullAllWith
|
1070 | */
|
1071 | pullAllWith<T2>(values?: List<T2>, comparator?: Comparator2<T, T2>): Collection<T>;
|
1072 | }
|
1073 | interface CollectionChain<T> {
|
1074 | /**
|
1075 | * @see _.pullAllWith
|
1076 | */
|
1077 | pullAllWith<T2>(values?: List<T2>, comparator?: Comparator2<T, T2>): CollectionChain<T>;
|
1078 | }
|
1079 | interface LoDashStatic {
|
1080 | /**
|
1081 | * Removes elements from array corresponding to the given indexes and returns an array of the removed elements.
|
1082 | * Indexes may be specified as an array of indexes or as individual arguments.
|
1083 | *
|
1084 | * Note: Unlike _.at, this method mutates array.
|
1085 | *
|
1086 | * @param array The array to modify.
|
1087 | * @param indexes The indexes of elements to remove, specified as individual indexes or arrays of indexes.
|
1088 | * @return Returns the new array of removed elements.
|
1089 | */
|
1090 | pullAt<T>(array: T[], ...indexes: Array<Many<number>>): T[];
|
1091 | /**
|
1092 | * @see _.pullAt
|
1093 | */
|
1094 | pullAt<T>(array: List<T>, ...indexes: Array<Many<number>>): List<T>;
|
1095 | }
|
1096 | interface Collection<T> {
|
1097 | /**
|
1098 | * @see _.pullAt
|
1099 | */
|
1100 | pullAt(...indexes: Array<Many<number>>): Collection<T>;
|
1101 | }
|
1102 | interface CollectionChain<T> {
|
1103 | /**
|
1104 | * @see _.pullAt
|
1105 | */
|
1106 | pullAt(...indexes: Array<Many<number>>): CollectionChain<T>;
|
1107 | }
|
1108 | interface LoDashStatic {
|
1109 | /**
|
1110 | * Removes all elements from array that predicate returns truthy for and returns an array of the removed
|
1111 | * elements. The predicate is invoked with three arguments: (value, index, array).
|
1112 | *
|
1113 | * Note: Unlike _.filter, this method mutates array.
|
1114 | *
|
1115 | * @param array The array to modify.
|
1116 | * @param predicate The function invoked per iteration.
|
1117 | * @return Returns the new array of removed elements.
|
1118 | */
|
1119 | remove<T>(array: List<T>, predicate?: ListIteratee<T>): T[];
|
1120 | }
|
1121 | interface Collection<T> {
|
1122 | /**
|
1123 | * @see _.remove
|
1124 | */
|
1125 | remove(predicate?: ListIteratee<T>): Collection<T>;
|
1126 | }
|
1127 | interface CollectionChain<T> {
|
1128 | /**
|
1129 | * @see _.remove
|
1130 | */
|
1131 | remove(predicate?: ListIteratee<T>): CollectionChain<T>;
|
1132 | }
|
1133 | interface LoDashStatic {
|
1134 | /**
|
1135 | * Reverses `array` so that the first element becomes the last, the second
|
1136 | * element becomes the second to last, and so on.
|
1137 | *
|
1138 | * **Note:** This method mutates `array` and is based on
|
1139 | * [`Array#reverse`](https://mdn.io/Array/reverse).
|
1140 | *
|
1141 | * @category Array
|
1142 | * @returns Returns `array`.
|
1143 | * @example
|
1144 | *
|
1145 | * var array = [1, 2, 3];
|
1146 | *
|
1147 | * _.reverse(array);
|
1148 | * // => [3, 2, 1]
|
1149 | *
|
1150 | * console.log(array);
|
1151 | * // => [3, 2, 1]
|
1152 | */
|
1153 | reverse<TList extends List<any>>(array: TList): TList;
|
1154 | }
|
1155 | interface LoDashStatic {
|
1156 | /**
|
1157 | * Creates a slice of array from start up to, but not including, end.
|
1158 | *
|
1159 | * @param array The array to slice.
|
1160 | * @param start The start position.
|
1161 | * @param end The end position.
|
1162 | * @return Returns the slice of array.
|
1163 | */
|
1164 | slice<T>(array: List<T> | null | undefined, start?: number, end?: number): T[];
|
1165 | }
|
1166 | interface Collection<T> {
|
1167 | /**
|
1168 | * @see _.slice
|
1169 | */
|
1170 | slice(start?: number, end?: number): Collection<T>;
|
1171 | }
|
1172 | interface CollectionChain<T> {
|
1173 | /**
|
1174 | * @see _.slice
|
1175 | */
|
1176 | slice(start?: number, end?: number): CollectionChain<T>;
|
1177 | }
|
1178 | interface LoDashStatic {
|
1179 | /**
|
1180 | * Uses a binary search to determine the lowest index at which `value` should
|
1181 | * be inserted into `array` in order to maintain its sort order.
|
1182 | *
|
1183 | * @category Array
|
1184 | * @param array The sorted array to inspect.
|
1185 | * @param value The value to evaluate.
|
1186 | * @returns Returns the index at which `value` should be inserted into `array`.
|
1187 | * @example
|
1188 | *
|
1189 | * _.sortedIndex([30, 50], 40);
|
1190 | * // => 1
|
1191 | *
|
1192 | * _.sortedIndex([4, 5], 4);
|
1193 | * // => 0
|
1194 | */
|
1195 | sortedIndex<T>(array: List<T> | null | undefined, value: T): number;
|
1196 | }
|
1197 | interface Collection<T> {
|
1198 | /**
|
1199 | * @see _.sortedIndex
|
1200 | */
|
1201 | sortedIndex(value: T): number;
|
1202 | }
|
1203 | interface CollectionChain<T> {
|
1204 | /**
|
1205 | * @see _.sortedIndex
|
1206 | */
|
1207 | sortedIndex(value: T): PrimitiveChain<number>;
|
1208 | }
|
1209 | interface LoDashStatic {
|
1210 | /**
|
1211 | * Uses a binary search to determine the lowest index at which `value` should
|
1212 | * be inserted into `array` in order to maintain its sort order.
|
1213 | *
|
1214 | * @category Array
|
1215 | * @param array The sorted array to inspect.
|
1216 | * @param value The value to evaluate.
|
1217 | * @returns Returns the index at which `value` should be inserted into `array`.
|
1218 | * @example
|
1219 | *
|
1220 | * _.sortedIndex([30, 50], 40);
|
1221 | * // => 1
|
1222 | *
|
1223 | * _.sortedIndex([4, 5], 4);
|
1224 | * // => 0
|
1225 | */
|
1226 | sortedIndex<T>(array: List<T> | null | undefined, value: T): number;
|
1227 | }
|
1228 | interface Collection<T> {
|
1229 | /**
|
1230 | * @see _.sortedIndex
|
1231 | */
|
1232 | sortedIndex(value: T): number;
|
1233 | }
|
1234 | interface CollectionChain<T> {
|
1235 | /**
|
1236 | * @see _.sortedIndex
|
1237 | */
|
1238 | sortedIndex(value: T): PrimitiveChain<number>;
|
1239 | }
|
1240 | interface LoDashStatic {
|
1241 | /**
|
1242 | * This method is like `_.sortedIndex` except that it accepts `iteratee`
|
1243 | * which is invoked for `value` and each element of `array` to compute their
|
1244 | * sort ranking. The iteratee is invoked with one argument: (value).
|
1245 | *
|
1246 | * @category Array
|
1247 | * @param array The sorted array to inspect.
|
1248 | * @param value The value to evaluate.
|
1249 | * @param [iteratee=_.identity] The iteratee invoked per element.
|
1250 | * @returns Returns the index at which `value` should be inserted into `array`.
|
1251 | * @example
|
1252 | *
|
1253 | * var dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 };
|
1254 | *
|
1255 | * _.sortedIndexBy(['thirty', 'fifty'], 'forty', _.propertyOf(dict));
|
1256 | * // => 1
|
1257 | *
|
1258 | * // using the `_.property` iteratee shorthand
|
1259 | * _.sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x');
|
1260 | * // => 0
|
1261 | */
|
1262 | sortedIndexBy<T>(array: List<T> | null | undefined, value: T, iteratee?: ValueIteratee<T>): number;
|
1263 | }
|
1264 | interface Collection<T> {
|
1265 | /**
|
1266 | * @see _.sortedIndexBy
|
1267 | */
|
1268 | sortedIndexBy(value: T, iteratee?: ValueIteratee<T>): number;
|
1269 | }
|
1270 | interface CollectionChain<T> {
|
1271 | /**
|
1272 | * @see _.sortedIndexBy
|
1273 | */
|
1274 | sortedIndexBy(value: T, iteratee?: ValueIteratee<T>): PrimitiveChain<number>;
|
1275 | }
|
1276 | interface LoDashStatic {
|
1277 | /**
|
1278 | * This method is like `_.indexOf` except that it performs a binary
|
1279 | * search on a sorted `array`.
|
1280 | *
|
1281 | * @category Array
|
1282 | * @param array The array to search.
|
1283 | * @param value The value to search for.
|
1284 | * @returns Returns the index of the matched value, else `-1`.
|
1285 | * @example
|
1286 | *
|
1287 | * _.sortedIndexOf([1, 1, 2, 2], 2);
|
1288 | * // => 2
|
1289 | */
|
1290 | sortedIndexOf<T>(array: List<T> | null | undefined, value: T): number;
|
1291 | }
|
1292 | interface Collection<T> {
|
1293 | /**
|
1294 | * @see _.sortedIndexOf
|
1295 | */
|
1296 | sortedIndexOf(value: T): number;
|
1297 | }
|
1298 | interface CollectionChain<T> {
|
1299 | /**
|
1300 | * @see _.sortedIndexOf
|
1301 | */
|
1302 | sortedIndexOf(value: T): PrimitiveChain<number>;
|
1303 | }
|
1304 | interface LoDashStatic {
|
1305 | /**
|
1306 | * This method is like `_.sortedIndex` except that it returns the highest
|
1307 | * index at which `value` should be inserted into `array` in order to
|
1308 | * maintain its sort order.
|
1309 | *
|
1310 | * @category Array
|
1311 | * @param array The sorted array to inspect.
|
1312 | * @param value The value to evaluate.
|
1313 | * @returns Returns the index at which `value` should be inserted into `array`.
|
1314 | * @example
|
1315 | *
|
1316 | * _.sortedLastIndex([4, 5], 4);
|
1317 | * // => 1
|
1318 | */
|
1319 | sortedLastIndex<T>(array: List<T> | null | undefined, value: T): number;
|
1320 | }
|
1321 | interface Collection<T> {
|
1322 | /**
|
1323 | * @see _.sortedLastIndex
|
1324 | */
|
1325 | sortedLastIndex(value: T): number;
|
1326 | }
|
1327 | interface CollectionChain<T> {
|
1328 | /**
|
1329 | * @see _.sortedLastIndex
|
1330 | */
|
1331 | sortedLastIndex(value: T): PrimitiveChain<number>;
|
1332 | }
|
1333 | interface LoDashStatic {
|
1334 | /**
|
1335 | * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
|
1336 | * which is invoked for `value` and each element of `array` to compute their
|
1337 | * sort ranking. The iteratee is invoked with one argument: (value).
|
1338 | *
|
1339 | * @category Array
|
1340 | * @param array The sorted array to inspect.
|
1341 | * @param value The value to evaluate.
|
1342 | * @param [iteratee=_.identity] The iteratee invoked per element.
|
1343 | * @returns Returns the index at which `value` should be inserted into `array`.
|
1344 | * @example
|
1345 | *
|
1346 | * // using the `_.property` iteratee shorthand
|
1347 | * _.sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x');
|
1348 | * // => 1
|
1349 | */
|
1350 | sortedLastIndexBy<T>(array: List<T> | null | undefined, value: T, iteratee: ValueIteratee<T>): number;
|
1351 | }
|
1352 | interface Collection<T> {
|
1353 | /**
|
1354 | * @see _.sortedLastIndexBy
|
1355 | */
|
1356 | sortedLastIndexBy(value: T, iteratee: ValueIteratee<T>): number;
|
1357 | }
|
1358 | interface CollectionChain<T> {
|
1359 | /**
|
1360 | * @see _.sortedLastIndexBy
|
1361 | */
|
1362 | sortedLastIndexBy(value: T, iteratee: ValueIteratee<T>): PrimitiveChain<number>;
|
1363 | }
|
1364 | interface LoDashStatic {
|
1365 | /**
|
1366 | * This method is like `_.lastIndexOf` except that it performs a binary
|
1367 | * search on a sorted `array`.
|
1368 | *
|
1369 | * @category Array
|
1370 | * @param array The array to search.
|
1371 | * @param value The value to search for.
|
1372 | * @returns Returns the index of the matched value, else `-1`.
|
1373 | * @example
|
1374 | *
|
1375 | * _.sortedLastIndexOf([1, 1, 2, 2], 2);
|
1376 | * // => 3
|
1377 | */
|
1378 | sortedLastIndexOf<T>(array: List<T> | null | undefined, value: T): number;
|
1379 | }
|
1380 | interface Collection<T> {
|
1381 | /**
|
1382 | * @see _.sortedLastIndexOf
|
1383 | */
|
1384 | sortedLastIndexOf(value: T): number;
|
1385 | }
|
1386 | interface CollectionChain<T> {
|
1387 | /**
|
1388 | * @see _.sortedLastIndexOf
|
1389 | */
|
1390 | sortedLastIndexOf(value: T): PrimitiveChain<number>;
|
1391 | }
|
1392 | interface LoDashStatic {
|
1393 | /**
|
1394 | * This method is like `_.uniq` except that it's designed and optimized
|
1395 | * for sorted arrays.
|
1396 | *
|
1397 | * @category Array
|
1398 | * @param array The array to inspect.
|
1399 | * @returns Returns the new duplicate free array.
|
1400 | * @example
|
1401 | *
|
1402 | * _.sortedUniq([1, 1, 2]);
|
1403 | * // => [1, 2]
|
1404 | */
|
1405 | sortedUniq<T>(array: List<T> | null | undefined): T[];
|
1406 | }
|
1407 | interface Collection<T> {
|
1408 | /**
|
1409 | * @see _.sortedUniq
|
1410 | */
|
1411 | sortedUniq(): Collection<T>;
|
1412 | }
|
1413 | interface CollectionChain<T> {
|
1414 | /**
|
1415 | * @see _.sortedUniq
|
1416 | */
|
1417 | sortedUniq(): CollectionChain<T>;
|
1418 | }
|
1419 | interface LoDashStatic {
|
1420 | /**
|
1421 | * This method is like `_.uniqBy` except that it's designed and optimized
|
1422 | * for sorted arrays.
|
1423 | *
|
1424 | * @category Array
|
1425 | * @param array The array to inspect.
|
1426 | * @param [iteratee] The iteratee invoked per element.
|
1427 | * @returns Returns the new duplicate free array.
|
1428 | * @example
|
1429 | *
|
1430 | * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
|
1431 | * // => [1.1, 2.3]
|
1432 | */
|
1433 | sortedUniqBy<T>(array: List<T> | null | undefined, iteratee: ValueIteratee<T>): T[];
|
1434 | }
|
1435 | interface Collection<T> {
|
1436 | /**
|
1437 | * @see _.sortedUniqBy
|
1438 | */
|
1439 | sortedUniqBy(iteratee: ValueIteratee<T>): Collection<T>;
|
1440 | }
|
1441 | interface CollectionChain<T> {
|
1442 | /**
|
1443 | * @see _.sortedUniqBy
|
1444 | */
|
1445 | sortedUniqBy(iteratee: ValueIteratee<T>): CollectionChain<T>;
|
1446 | }
|
1447 | interface LoDashStatic {
|
1448 | /**
|
1449 | * Gets all but the first element of array.
|
1450 | *
|
1451 | * @param array The array to query.
|
1452 | * @return Returns the slice of array.
|
1453 | */
|
1454 | tail<T extends unknown[]>(array: readonly [unknown, ...T]): T;
|
1455 | tail<T>(array: List<T> | null | undefined): T[];
|
1456 | }
|
1457 | interface Collection<T> {
|
1458 | /**
|
1459 | * @see _.tail
|
1460 | */
|
1461 | tail(): Collection<T>;
|
1462 | }
|
1463 | interface CollectionChain<T> {
|
1464 | /**
|
1465 | * @see _.tail
|
1466 | */
|
1467 | tail(): CollectionChain<T>;
|
1468 | }
|
1469 | interface LoDashStatic {
|
1470 | /**
|
1471 | * Creates a slice of array with n elements taken from the beginning.
|
1472 | *
|
1473 | * @param array The array to query.
|
1474 | * @param n The number of elements to take.
|
1475 | * @return Returns the slice of array.
|
1476 | */
|
1477 | take<T>(array: List<T> | null | undefined, n?: number): T[];
|
1478 | }
|
1479 | interface Collection<T> {
|
1480 | /**
|
1481 | * @see _.take
|
1482 | */
|
1483 | take(n?: number): Collection<T>;
|
1484 | }
|
1485 | interface CollectionChain<T> {
|
1486 | /**
|
1487 | * @see _.take
|
1488 | */
|
1489 | take(n?: number): CollectionChain<T>;
|
1490 | }
|
1491 | interface LoDashStatic {
|
1492 | /**
|
1493 | * Creates a slice of array with n elements taken from the end.
|
1494 | *
|
1495 | * @param array The array to query.
|
1496 | * @param n The number of elements to take.
|
1497 | * @return Returns the slice of array.
|
1498 | */
|
1499 | takeRight<T>(array: List<T> | null | undefined, n?: number): T[];
|
1500 | }
|
1501 | interface Collection<T> {
|
1502 | /**
|
1503 | * @see _.takeRight
|
1504 | */
|
1505 | takeRight(n?: number): Collection<T>;
|
1506 | }
|
1507 | interface CollectionChain<T> {
|
1508 | /**
|
1509 | * @see _.takeRight
|
1510 | */
|
1511 | takeRight(n?: number): CollectionChain<T>;
|
1512 | }
|
1513 | interface LoDashStatic {
|
1514 | /**
|
1515 | * Creates a slice of array with elements taken from the end. Elements are taken until predicate returns
|
1516 | * falsey. The predicate is invoked with three arguments: (value, index, array).
|
1517 | *
|
1518 | * @param array The array to query.
|
1519 | * @param predicate The function invoked per iteration.
|
1520 | * @return Returns the slice of array.
|
1521 | */
|
1522 | takeRightWhile<T>(array: List<T> | null | undefined, predicate?: ListIteratee<T>): T[];
|
1523 | }
|
1524 | interface Collection<T> {
|
1525 | /**
|
1526 | * @see _.takeRightWhile
|
1527 | */
|
1528 | takeRightWhile(predicate?: ListIteratee<T>): Collection<T>;
|
1529 | }
|
1530 | interface CollectionChain<T> {
|
1531 | /**
|
1532 | * @see _.takeRightWhile
|
1533 | */
|
1534 | takeRightWhile(predicate?: ListIteratee<T>): CollectionChain<T>;
|
1535 | }
|
1536 | interface LoDashStatic {
|
1537 | /**
|
1538 | * Creates a slice of array with elements taken from the beginning. Elements are taken until predicate returns
|
1539 | * falsey. The predicate is invoked with three arguments: (value, index, array).
|
1540 | *
|
1541 | * @param array The array to query.
|
1542 | * @param predicate The function invoked per iteration.
|
1543 | * @return Returns the slice of array.
|
1544 | */
|
1545 | takeWhile<T>(array: List<T> | null | undefined, predicate?: ListIteratee<T>): T[];
|
1546 | }
|
1547 | interface Collection<T> {
|
1548 | /**
|
1549 | * @see _.takeWhile
|
1550 | */
|
1551 | takeWhile(predicate?: ListIteratee<T>): Collection<T>;
|
1552 | }
|
1553 | interface CollectionChain<T> {
|
1554 | /**
|
1555 | * @see _.takeWhile
|
1556 | */
|
1557 | takeWhile(predicate?: ListIteratee<T>): CollectionChain<T>;
|
1558 | }
|
1559 | interface LoDashStatic {
|
1560 | /**
|
1561 | * Creates an array of unique values, in order, from all of the provided arrays using SameValueZero for
|
1562 | * equality comparisons.
|
1563 | *
|
1564 | * @param arrays The arrays to inspect.
|
1565 | * @return Returns the new array of combined values.
|
1566 | */
|
1567 | union<T>(...arrays: Array<List<T> | null | undefined>): T[];
|
1568 | }
|
1569 | interface Collection<T> {
|
1570 | /**
|
1571 | * @see _.union
|
1572 | */
|
1573 | union(...arrays: Array<List<T> | null | undefined>): Collection<T>;
|
1574 | }
|
1575 | interface CollectionChain<T> {
|
1576 | /**
|
1577 | * @see _.union
|
1578 | */
|
1579 | union(...arrays: Array<List<T> | null | undefined>): CollectionChain<T>;
|
1580 | }
|
1581 | interface LoDashStatic {
|
1582 | /**
|
1583 | * This method is like `_.union` except that it accepts `iteratee` which is
|
1584 | * invoked for each element of each `arrays` to generate the criterion by which
|
1585 | * uniqueness is computed. The iteratee is invoked with one argument: (value).
|
1586 | *
|
1587 | * @param arrays The arrays to inspect.
|
1588 | * @param iteratee The iteratee invoked per element.
|
1589 | * @return Returns the new array of combined values.
|
1590 | */
|
1591 | unionBy<T>(arrays: List<T> | null | undefined, iteratee?: ValueIteratee<T>): T[];
|
1592 | /**
|
1593 | * @see _.unionBy
|
1594 | */
|
1595 | unionBy<T>(arrays1: List<T> | null | undefined, arrays2: List<T> | null | undefined, iteratee?: ValueIteratee<T>): T[];
|
1596 | /**
|
1597 | * @see _.unionBy
|
1598 | */
|
1599 | unionBy<T>(arrays1: List<T> | null | undefined, arrays2: List<T> | null | undefined, arrays3: List<T> | null | undefined, iteratee?: ValueIteratee<T>): T[];
|
1600 | /**
|
1601 | * @see _.unionBy
|
1602 | */
|
1603 | unionBy<T>(arrays1: List<T> | null | undefined, arrays2: List<T> | null | undefined, arrays3: List<T> | null | undefined, arrays4: List<T> | null | undefined, iteratee?: ValueIteratee<T>): T[];
|
1604 | /**
|
1605 | * @see _.unionBy
|
1606 | */
|
1607 | unionBy<T>(arrays1: List<T> | null | undefined, arrays2: List<T> | null | undefined, arrays3: List<T> | null | undefined, arrays4: List<T> | null | undefined, arrays5: List<T> | null | undefined, ...iteratee: Array<ValueIteratee<T> | List<T> | null | undefined>): T[];
|
1608 | }
|
1609 | interface Collection<T> {
|
1610 | /**
|
1611 | * @see _.unionBy
|
1612 | */
|
1613 | unionBy(arrays2: List<T> | null | undefined, iteratee?: ValueIteratee<T>): Collection<T>;
|
1614 | /**
|
1615 | * @see _.unionBy
|
1616 | */
|
1617 | unionBy(...iteratee: Array<ValueIteratee<T> | List<T> | null | undefined>): Collection<T>;
|
1618 | }
|
1619 | interface CollectionChain<T> {
|
1620 | /**
|
1621 | * @see _.unionBy
|
1622 | */
|
1623 | unionBy(arrays2: List<T> | null | undefined, iteratee?: ValueIteratee<T>): CollectionChain<T>;
|
1624 | /**
|
1625 | * @see _.unionBy
|
1626 | */
|
1627 | unionBy(...iteratee: Array<ValueIteratee<T> | List<T> | null | undefined>): CollectionChain<T>;
|
1628 | }
|
1629 | interface LoDashStatic {
|
1630 | /**
|
1631 | * This method is like `_.union` except that it accepts `comparator` which
|
1632 | * is invoked to compare elements of `arrays`. The comparator is invoked
|
1633 | * with two arguments: (arrVal, othVal).
|
1634 | *
|
1635 | * @category Array
|
1636 | * @param [arrays] The arrays to inspect.
|
1637 | * @param [comparator] The comparator invoked per element.
|
1638 | * @returns Returns the new array of combined values.
|
1639 | * @example
|
1640 | *
|
1641 | * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
|
1642 | * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
|
1643 | *
|
1644 | * _.unionWith(objects, others, _.isEqual);
|
1645 | * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
|
1646 | */
|
1647 | unionWith<T>(arrays: List<T> | null | undefined, comparator?: Comparator<T>): T[];
|
1648 | /**
|
1649 | * @see _.unionWith
|
1650 | */
|
1651 | unionWith<T>(arrays: List<T> | null | undefined, arrays2: List<T> | null | undefined, comparator?: Comparator<T>): T[];
|
1652 | /**
|
1653 | * @see _.unionWith
|
1654 | */
|
1655 | unionWith<T>(arrays: List<T> | null | undefined, arrays2: List<T> | null | undefined, arrays3: List<T> | null | undefined, ...comparator: Array<Comparator<T> | List<T> | null | undefined>): T[];
|
1656 | }
|
1657 | interface Collection<T> {
|
1658 | /**
|
1659 | * @see _.unionWith
|
1660 | */
|
1661 | unionWith(arrays2: List<T> | null | undefined, comparator?: Comparator<T>): Collection<T>;
|
1662 | /**
|
1663 | * @see _.unionWith
|
1664 | */
|
1665 | unionWith(...comparator: Array<Comparator<T> | List<T> | null | undefined>): Collection<T>;
|
1666 | }
|
1667 | interface CollectionChain<T> {
|
1668 | /**
|
1669 | * @see _.unionWith
|
1670 | */
|
1671 | unionWith(arrays2: List<T> | null | undefined, comparator?: Comparator<T>): CollectionChain<T>;
|
1672 | /**
|
1673 | * @see _.unionWith
|
1674 | */
|
1675 | unionWith(...comparator: Array<Comparator<T> | List<T> | null | undefined>): CollectionChain<T>;
|
1676 | }
|
1677 | interface LoDashStatic {
|
1678 | /**
|
1679 | * Creates a duplicate-free version of an array, using
|
1680 | * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
1681 | * for equality comparisons, in which only the first occurrence of each element
|
1682 | * is kept.
|
1683 | *
|
1684 | * @category Array
|
1685 | * @param array The array to inspect.
|
1686 | * @returns Returns the new duplicate free array.
|
1687 | * @example
|
1688 | *
|
1689 | * _.uniq([2, 1, 2]);
|
1690 | * // => [2, 1]
|
1691 | */
|
1692 | uniq<T>(array: List<T> | null | undefined): T[];
|
1693 | }
|
1694 | interface Collection<T> {
|
1695 | /**
|
1696 | * @see _.uniq
|
1697 | */
|
1698 | uniq(): Collection<T>;
|
1699 | }
|
1700 | interface CollectionChain<T> {
|
1701 | /**
|
1702 | * @see _.uniq
|
1703 | */
|
1704 | uniq(): CollectionChain<T>;
|
1705 | }
|
1706 | interface LoDashStatic {
|
1707 | /**
|
1708 | * This method is like `_.uniq` except that it accepts `iteratee` which is
|
1709 | * invoked for each element in `array` to generate the criterion by which
|
1710 | * uniqueness is computed. The iteratee is invoked with one argument: (value).
|
1711 | *
|
1712 | * @category Array
|
1713 | * @param array The array to inspect.
|
1714 | * @param [iteratee=_.identity] The iteratee invoked per element.
|
1715 | * @returns Returns the new duplicate free array.
|
1716 | * @example
|
1717 | *
|
1718 | * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
|
1719 | * // => [2.1, 1.2]
|
1720 | *
|
1721 | * // using the `_.property` iteratee shorthand
|
1722 | * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
|
1723 | * // => [{ 'x': 1 }, { 'x': 2 }]
|
1724 | */
|
1725 | uniqBy<T>(array: List<T> | null | undefined, iteratee: ValueIteratee<T>): T[];
|
1726 | }
|
1727 | interface Collection<T> {
|
1728 | /**
|
1729 | * @see _.uniqBy
|
1730 | */
|
1731 | uniqBy(iteratee: ValueIteratee<T>): Collection<T>;
|
1732 | }
|
1733 | interface CollectionChain<T> {
|
1734 | /**
|
1735 | * @see _.uniqBy
|
1736 | */
|
1737 | uniqBy(iteratee: ValueIteratee<T>): CollectionChain<T>;
|
1738 | }
|
1739 | interface LoDashStatic {
|
1740 | /**
|
1741 | * This method is like `_.uniq` except that it accepts `comparator` which
|
1742 | * is invoked to compare elements of `array`. The comparator is invoked with
|
1743 | * two arguments: (arrVal, othVal).
|
1744 | *
|
1745 | * @category Array
|
1746 | * @param array The array to inspect.
|
1747 | * @param [comparator] The comparator invoked per element.
|
1748 | * @returns Returns the new duplicate free array.
|
1749 | * @example
|
1750 | *
|
1751 | * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
|
1752 | *
|
1753 | * _.uniqWith(objects, _.isEqual);
|
1754 | * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
|
1755 | */
|
1756 | uniqWith<T>(array: List<T> | null | undefined, comparator?: Comparator<T>): T[];
|
1757 | }
|
1758 | interface Collection<T> {
|
1759 | /**
|
1760 | * @see _.uniqWith
|
1761 | */
|
1762 | uniqWith(comparator?: Comparator<T>): Collection<T>;
|
1763 | }
|
1764 | interface CollectionChain<T> {
|
1765 | /**
|
1766 | * @see _.uniqWith
|
1767 | */
|
1768 | uniqWith(comparator?: Comparator<T>): CollectionChain<T>;
|
1769 | }
|
1770 | interface LoDashStatic {
|
1771 | /**
|
1772 | * This method is like _.zip except that it accepts an array of grouped elements and creates an array
|
1773 | * regrouping the elements to their pre-zip configuration.
|
1774 | *
|
1775 | * @param array The array of grouped elements to process.
|
1776 | * @return Returns the new array of regrouped elements.
|
1777 | */
|
1778 | unzip<T>(array: T[][] | List<List<T>> | null | undefined): T[][];
|
1779 | }
|
1780 | interface Collection<T> {
|
1781 | /**
|
1782 | * @see _.unzip
|
1783 | */
|
1784 | unzip(): T extends List<infer U> ? Collection<U[]> : unknown;
|
1785 | }
|
1786 | interface CollectionChain<T> {
|
1787 | /**
|
1788 | * @see _.unzip
|
1789 | */
|
1790 | unzip(): T extends List<infer U> ? CollectionChain<U[]> : unknown;
|
1791 | }
|
1792 | interface LoDashStatic {
|
1793 | /**
|
1794 | * This method is like _.unzip except that it accepts an iteratee to specify how regrouped values should be
|
1795 | * combined. The iteratee is invoked with four arguments: (accumulator, value, index, group).
|
1796 | *
|
1797 | * @param array The array of grouped elements to process.
|
1798 | * @param iteratee The function to combine regrouped values.
|
1799 | * @return Returns the new array of regrouped elements.
|
1800 | */
|
1801 | unzipWith<T, TResult>(array: List<List<T>> | null | undefined, iteratee: (...values: T[]) => TResult): TResult[];
|
1802 | /**
|
1803 | * @see _.unzipWith
|
1804 | */
|
1805 | unzipWith<T>(array: List<List<T>> | null | undefined): T[][];
|
1806 | }
|
1807 | interface Collection<T> {
|
1808 | /**
|
1809 | * @see _.unzipWith
|
1810 | */
|
1811 | unzipWith<TResult>(iteratee: (...values: Array<T extends List<infer U> ? U : unknown>) => TResult): Collection<TResult>;
|
1812 | /**
|
1813 | * @see _.unzipWith
|
1814 | */
|
1815 | unzipWith(): T extends List<infer U> ? Collection<U[]> : unknown;
|
1816 | }
|
1817 | interface CollectionChain<T> {
|
1818 | /**
|
1819 | * @see _.unzipWith
|
1820 | */
|
1821 | unzipWith<TResult>(iteratee: (...values: Array<T extends List<infer U> ? U : unknown>) => TResult): CollectionChain<TResult>;
|
1822 | /**
|
1823 | * @see _.unzipWith
|
1824 | */
|
1825 | unzipWith(): T extends List<infer U> ? CollectionChain<U[]> : unknown;
|
1826 | }
|
1827 | interface LoDashStatic {
|
1828 | /**
|
1829 | * Creates an array excluding all provided values using SameValueZero for equality comparisons.
|
1830 | *
|
1831 | * @param array The array to filter.
|
1832 | * @param values The values to exclude.
|
1833 | * @return Returns the new array of filtered values.
|
1834 | */
|
1835 | without<T>(array: List<T> | null | undefined, ...values: T[]): T[];
|
1836 | }
|
1837 | interface Collection<T> {
|
1838 | /**
|
1839 | * @see _.without
|
1840 | */
|
1841 | without(...values: T[]): Collection<T>;
|
1842 | }
|
1843 | interface CollectionChain<T> {
|
1844 | /**
|
1845 | * @see _.without
|
1846 | */
|
1847 | without(...values: T[]): CollectionChain<T>;
|
1848 | }
|
1849 | interface LoDashStatic {
|
1850 | /**
|
1851 | * Creates an array of unique values that is the symmetric difference of the provided arrays.
|
1852 | *
|
1853 | * @param arrays The arrays to inspect.
|
1854 | * @return Returns the new array of values.
|
1855 | */
|
1856 | xor<T>(...arrays: Array<List<T> | null | undefined>): T[];
|
1857 | }
|
1858 | interface Collection<T> {
|
1859 | /**
|
1860 | * @see _.xor
|
1861 | */
|
1862 | xor(...arrays: Array<List<T> | null | undefined>): Collection<T>;
|
1863 | }
|
1864 | interface CollectionChain<T> {
|
1865 | /**
|
1866 | * @see _.xor
|
1867 | */
|
1868 | xor(...arrays: Array<List<T> | null | undefined>): CollectionChain<T>;
|
1869 | }
|
1870 | interface LoDashStatic {
|
1871 | /**
|
1872 | * This method is like `_.xor` except that it accepts `iteratee` which is
|
1873 | * invoked for each element of each `arrays` to generate the criterion by which
|
1874 | * uniqueness is computed. The iteratee is invoked with one argument: (value).
|
1875 | *
|
1876 | * @category Array
|
1877 | * @param [arrays] The arrays to inspect.
|
1878 | * @param [iteratee=_.identity] The iteratee invoked per element.
|
1879 | * @returns Returns the new array of values.
|
1880 | * @example
|
1881 | *
|
1882 | * _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor);
|
1883 | * // => [1.2, 4.3]
|
1884 | *
|
1885 | * // using the `_.property` iteratee shorthand
|
1886 | * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
|
1887 | * // => [{ 'x': 2 }]
|
1888 | */
|
1889 | xorBy<T>(arrays: List<T> | null | undefined, iteratee?: ValueIteratee<T>): T[];
|
1890 | /**
|
1891 | * @see _.xorBy
|
1892 | */
|
1893 | xorBy<T>(arrays: List<T> | null | undefined, arrays2: List<T> | null | undefined, iteratee?: ValueIteratee<T>): T[];
|
1894 | /**
|
1895 | * @see _.xorBy
|
1896 | */
|
1897 | xorBy<T>(arrays: List<T> | null | undefined, arrays2: List<T> | null | undefined, arrays3: List<T> | null | undefined, ...iteratee: Array<ValueIteratee<T> | List<T> | null | undefined>): T[];
|
1898 | }
|
1899 | interface Collection<T> {
|
1900 | /**
|
1901 | * @see _.xorBy
|
1902 | */
|
1903 | xorBy(arrays2: List<T> | null | undefined, iteratee?: ValueIteratee<T>): Collection<T>;
|
1904 | /**
|
1905 | * @see _.xorBy
|
1906 | */
|
1907 | xorBy(...iteratee: Array<ValueIteratee<T> | List<T> | null | undefined>): Collection<T>;
|
1908 | }
|
1909 | interface CollectionChain<T> {
|
1910 | /**
|
1911 | * @see _.xorBy
|
1912 | */
|
1913 | xorBy(arrays2: List<T> | null | undefined, iteratee?: ValueIteratee<T>): CollectionChain<T>;
|
1914 | /**
|
1915 | * @see _.xorBy
|
1916 | */
|
1917 | xorBy(...iteratee: Array<ValueIteratee<T> | List<T> | null | undefined>): CollectionChain<T>;
|
1918 | }
|
1919 | interface LoDashStatic {
|
1920 | /**
|
1921 | * This method is like `_.xor` except that it accepts `comparator` which is
|
1922 | * invoked to compare elements of `arrays`. The comparator is invoked with
|
1923 | * two arguments: (arrVal, othVal).
|
1924 | *
|
1925 | * @category Array
|
1926 | * @param [arrays] The arrays to inspect.
|
1927 | * @param [comparator] The comparator invoked per element.
|
1928 | * @returns Returns the new array of values.
|
1929 | * @example
|
1930 | *
|
1931 | * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
|
1932 | * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
|
1933 | *
|
1934 | * _.xorWith(objects, others, _.isEqual);
|
1935 | * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
|
1936 | */
|
1937 | xorWith<T>(arrays: List<T> | null | undefined, comparator?: Comparator<T>): T[];
|
1938 | /**
|
1939 | * @see _.xorWith
|
1940 | */
|
1941 | xorWith<T>(arrays: List<T> | null | undefined, arrays2: List<T> | null | undefined, comparator?: Comparator<T>): T[];
|
1942 | /**
|
1943 | * @see _.xorWith
|
1944 | */
|
1945 | xorWith<T>(arrays: List<T> | null | undefined, arrays2: List<T> | null | undefined, arrays3: List<T> | null | undefined, ...comparator: Array<Comparator<T> | List<T> | null | undefined>): T[];
|
1946 | }
|
1947 | interface Collection<T> {
|
1948 | /**
|
1949 | * @see _.xorWith
|
1950 | */
|
1951 | xorWith(arrays2: List<T> | null | undefined, comparator?: Comparator<T>): Collection<T>;
|
1952 | /**
|
1953 | * @see _.xorWith
|
1954 | */
|
1955 | xorWith(...comparator: Array<Comparator<T> | List<T> | null | undefined>): Collection<T>;
|
1956 | }
|
1957 | interface CollectionChain<T> {
|
1958 | /**
|
1959 | * @see _.xorWith
|
1960 | */
|
1961 | xorWith(arrays2: List<T> | null | undefined, comparator?: Comparator<T>): CollectionChain<T>;
|
1962 | /**
|
1963 | * @see _.xorWith
|
1964 | */
|
1965 | xorWith(...comparator: Array<Comparator<T> | List<T> | null | undefined>): CollectionChain<T>;
|
1966 | }
|
1967 | interface LoDashStatic {
|
1968 | /**
|
1969 | * Creates an array of grouped elements, the first of which contains the first elements of the given arrays,
|
1970 | * the second of which contains the second elements of the given arrays, and so on.
|
1971 | *
|
1972 | * @param arrays The arrays to process.
|
1973 | * @return Returns the new array of grouped elements.
|
1974 | */
|
1975 | zip<T1, T2>(arrays1: List<T1>, arrays2: List<T2>): Array<[T1 | undefined, T2 | undefined]>;
|
1976 | /**
|
1977 | * @see _.zip
|
1978 | */
|
1979 | zip<T1, T2, T3>(arrays1: List<T1>, arrays2: List<T2>, arrays3: List<T3>): Array<[T1 | undefined, T2 | undefined, T3 | undefined]>;
|
1980 | /**
|
1981 | * @see _.zip
|
1982 | */
|
1983 | zip<T1, T2, T3, T4>(arrays1: List<T1>, arrays2: List<T2>, arrays3: List<T3>, arrays4: List<T4>): Array<[T1 | undefined, T2 | undefined, T3 | undefined, T4 | undefined]>;
|
1984 | /**
|
1985 | * @see _.zip
|
1986 | */
|
1987 | zip<T1, T2, T3, T4, T5>(arrays1: List<T1>, arrays2: List<T2>, arrays3: List<T3>, arrays4: List<T4>, arrays5: List<T5>): Array<[T1 | undefined, T2 | undefined, T3 | undefined, T4 | undefined, T5 | undefined]>;
|
1988 | /**
|
1989 | * @see _.zip
|
1990 | */
|
1991 | zip<T>(...arrays: Array<List<T> | null | undefined>): Array<Array<T | undefined>>;
|
1992 | }
|
1993 | interface Collection<T> {
|
1994 | /**
|
1995 | * @see _.zip
|
1996 | */
|
1997 | zip<T2>(arrays2: List<T2>): Collection<[T | undefined, T2 | undefined]>;
|
1998 | /**
|
1999 | * @see _.zip
|
2000 | */
|
2001 | zip(...arrays: Array<List<T> | null | undefined>): Collection<Array<T | undefined>>;
|
2002 | }
|
2003 | interface CollectionChain<T> {
|
2004 | /**
|
2005 | * @see _.zip
|
2006 | */
|
2007 | zip<T2>(arrays2: List<T2>): CollectionChain<[T | undefined, T2 | undefined]>;
|
2008 | /**
|
2009 | * @see _.zip
|
2010 | */
|
2011 | zip(...arrays: Array<List<T> | null | undefined>): CollectionChain<Array<T | undefined>>;
|
2012 | }
|
2013 | interface LoDashStatic {
|
2014 | /**
|
2015 | * This method is like _.fromPairs except that it accepts two arrays, one of property
|
2016 | * identifiers and one of corresponding values.
|
2017 | *
|
2018 | * @param props The property names.
|
2019 | * @param values The property values.
|
2020 | * @return Returns the new object.
|
2021 | */
|
2022 | zipObject<T>(props: List<PropertyName>, values: List<T>): Dictionary<T>;
|
2023 | /**
|
2024 | * @see _.zipObject
|
2025 | */
|
2026 | zipObject(props?: List<PropertyName>): Dictionary<undefined>;
|
2027 | }
|
2028 | interface Collection<T> {
|
2029 | /**
|
2030 | * @see _.zipObject
|
2031 | */
|
2032 | zipObject<U>(values: List<U>): Object<Dictionary<U>>;
|
2033 | /**
|
2034 | * @see _.zipObject
|
2035 | */
|
2036 | zipObject(): Object<Dictionary<undefined>>;
|
2037 | }
|
2038 | interface CollectionChain<T> {
|
2039 | /**
|
2040 | * @see _.zipObject
|
2041 | */
|
2042 | zipObject<U>(values: List<U>): ObjectChain<Dictionary<U>>;
|
2043 | /**
|
2044 | * @see _.zipObject
|
2045 | */
|
2046 | zipObject(): ObjectChain<Dictionary<undefined>>;
|
2047 | }
|
2048 | interface LoDashStatic {
|
2049 | /**
|
2050 | * This method is like _.zipObject except that it supports property paths.
|
2051 | *
|
2052 | * @param paths The property names.
|
2053 | * @param values The property values.
|
2054 | * @return Returns the new object.
|
2055 | */
|
2056 | zipObjectDeep(paths?: List<PropertyPath>, values?: List<any>): object;
|
2057 | }
|
2058 | interface Collection<T> {
|
2059 | /**
|
2060 | * @see _.zipObjectDeep
|
2061 | */
|
2062 | zipObjectDeep(values?: List<any>): Object<object>;
|
2063 | }
|
2064 | interface CollectionChain<T> {
|
2065 | /**
|
2066 | * @see _.zipObjectDeep
|
2067 | */
|
2068 | zipObjectDeep(values?: List<any>): ObjectChain<object>;
|
2069 | }
|
2070 | interface LoDashStatic {
|
2071 | /**
|
2072 | * This method is like _.zip except that it accepts an iteratee to specify how grouped values should be
|
2073 | * combined. The iteratee is invoked with four arguments: (accumulator, value, index,
|
2074 | * group).
|
2075 | * @param arrays The arrays to process.
|
2076 | * @param iteratee The function to combine grouped values.
|
2077 | * @return Returns the new array of grouped elements.
|
2078 | */
|
2079 | zipWith<T, TResult>(arrays: List<T>, iteratee: (value1: T) => TResult): TResult[];
|
2080 | /**
|
2081 | * @see _.zipWith
|
2082 | */
|
2083 | zipWith<T1, T2, TResult>(arrays1: List<T1>, arrays2: List<T2>, iteratee: (value1: T1, value2: T2) => TResult): TResult[];
|
2084 | /**
|
2085 | * @see _.zipWith
|
2086 | */
|
2087 | zipWith<T1, T2, T3, TResult>(arrays1: List<T1>, arrays2: List<T2>, arrays3: List<T3>, iteratee: (value1: T1, value2: T2, value3: T3) => TResult): TResult[];
|
2088 | /**
|
2089 | * @see _.zipWith
|
2090 | */
|
2091 | zipWith<T1, T2, T3, T4, TResult>(arrays1: List<T1>, arrays2: List<T2>, arrays3: List<T3>, arrays4: List<T4>, iteratee: (value1: T1, value2: T2, value3: T3, value4: T4) => TResult): TResult[];
|
2092 | /**
|
2093 | * @see _.zipWith
|
2094 | */
|
2095 | zipWith<T1, T2, T3, T4, T5, TResult>(arrays1: List<T1>, arrays2: List<T2>, arrays3: List<T3>, arrays4: List<T4>, arrays5: List<T5>, iteratee: (value1: T1, value2: T2, value3: T3, value4: T4, value5: T5) => TResult): TResult[];
|
2096 | /**
|
2097 | * @see _.zipWith
|
2098 | */
|
2099 | zipWith<T, TResult>(...iteratee: Array<((...group: T[]) => TResult) | List<T> | null | undefined>): TResult[];
|
2100 | }
|
2101 | interface Collection<T> {
|
2102 | /**
|
2103 | * @see _.zipWith
|
2104 | */
|
2105 | zipWith<T2, TResult>(arrays2: List<T2>, iteratee: (value1: T, value2: T2) => TResult): Collection<TResult>;
|
2106 | /**
|
2107 | * @see _.zipWith
|
2108 | */
|
2109 | zipWith<T2, T3, TResult>(arrays2: List<T2>, arrays3: List<T3>, iteratee: (value1: T, value2: T2, value3: T3) => TResult): Collection<TResult>;
|
2110 | /**
|
2111 | * @see _.zipWith
|
2112 | */
|
2113 | zipWith<TResult>(...iteratee: Array<((...group: T[]) => TResult) | List<T> | null | undefined>): Collection<TResult>;
|
2114 | }
|
2115 | interface CollectionChain<T> {
|
2116 | /**
|
2117 | * @see _.zipWith
|
2118 | */
|
2119 | zipWith<T2, TResult>(arrays2: List<T2>, iteratee: (value1: T, value2: T2) => TResult): CollectionChain<TResult>;
|
2120 | /**
|
2121 | * @see _.zipWith
|
2122 | */
|
2123 | zipWith<T2, T3, TResult>(arrays2: List<T2>, arrays3: List<T3>, iteratee: (value1: T, value2: T2, value3: T3) => TResult): CollectionChain<TResult>;
|
2124 | /**
|
2125 | * @see _.zipWith
|
2126 | */
|
2127 | zipWith<TResult>(...iteratee: Array<((...group: T[]) => TResult) | List<T> | null | undefined>): CollectionChain<TResult>;
|
2128 | }
|
2129 | }
|
2130 |
|
\ | No newline at end of file |