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, "", 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 | null | undefined | false | "" | 0> | null | undefined): T[];
|
35 | }
|
36 |
|
37 | type Truthy<T> = T extends null | undefined | false | "" | 0 ? never : T;
|
38 | interface Collection<T> {
|
39 | /**
|
40 | * @see _.compact
|
41 | */
|
42 | compact(): Collection<Truthy<T>>;
|
43 | }
|
44 | interface CollectionChain<T> {
|
45 | /**
|
46 | * @see _.compact
|
47 | */
|
48 | compact(): CollectionChain<Truthy<T>>;
|
49 | }
|
50 | interface LoDashStatic {
|
51 | /**
|
52 | * Creates a new array concatenating `array` with any additional arrays
|
53 | * and/or values.
|
54 | *
|
55 | * @category Array
|
56 | * @param array The array to concatenate.
|
57 | * @param [values] The 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>(array: Many<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 unique array values not included in the other provided arrays using SameValueZero for
|
111 | * equality comparisons.
|
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 of array
|
134 | * and values to generate the criterion by which uniqueness is computed. The iteratee is invoked with one
|
135 | * 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 | * Creates an array of unique `array` values not included in the other
|
191 | * provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
192 | * for equality comparisons.
|
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 | type Flat<T> = (T extends List<any> ? never : T);
|
492 | interface LoDashStatic {
|
493 | /**
|
494 | * Recursively flattens a nested array.
|
495 | *
|
496 | * @param array The array to recursively flatten.
|
497 | * @return Returns the new flattened array.
|
498 | */
|
499 | flattenDeep<T>(array: ListOfRecursiveArraysOrValues<T> | null | undefined): Array<Flat<T>>;
|
500 | }
|
501 | interface Collection<T> {
|
502 | /**
|
503 | * @see _.flattenDeep
|
504 | */
|
505 | flattenDeep(): T extends ListOfRecursiveArraysOrValues<infer U> ? Collection<Flat<U>> : Collection<T>;
|
506 | }
|
507 | interface CollectionChain<T> {
|
508 | /**
|
509 | * @see _.flattenDeep
|
510 | */
|
511 | flattenDeep(): T extends ListOfRecursiveArraysOrValues<infer U> ? CollectionChain<Flat<U>> : CollectionChain<T>;
|
512 | }
|
513 | interface LoDashStatic {
|
514 | /**
|
515 | * Recursively flatten array up to depth times.
|
516 | *
|
517 | * @param array The array to recursively flatten.
|
518 | * @param number The maximum recursion depth.
|
519 | * @return Returns the new flattened array.
|
520 | */
|
521 | flattenDepth<T>(array: ListOfRecursiveArraysOrValues<T> | null | undefined, depth?: number): T[];
|
522 | }
|
523 | interface Collection<T> {
|
524 | /**
|
525 | * @see _.flattenDepth
|
526 | */
|
527 | flattenDepth(depth?: number): Collection<T>;
|
528 | }
|
529 | interface CollectionChain<T> {
|
530 | /**
|
531 | * @see _.flattenDepth
|
532 | */
|
533 | flattenDepth(depth?: number): CollectionChain<T>;
|
534 | }
|
535 | interface LoDashStatic {
|
536 | /**
|
537 | * The inverse of `_.toPairs`; this method returns an object composed
|
538 | * from key-value `pairs`.
|
539 | *
|
540 | * @category Array
|
541 | * @param pairs The key-value pairs.
|
542 | * @returns Returns the new object.
|
543 | * @example
|
544 | *
|
545 | * _.fromPairs([['fred', 30], ['barney', 40]]);
|
546 | * // => { 'fred': 30, 'barney': 40 }
|
547 | */
|
548 | fromPairs<T>(pairs: List<[PropertyName, T]> | null | undefined): Dictionary<T>;
|
549 | /**
|
550 | * @see _.fromPairs
|
551 | */
|
552 | fromPairs(pairs: List<any[]> | null | undefined): Dictionary<any>;
|
553 | }
|
554 | interface Collection<T> {
|
555 | /**
|
556 | * @see _.fromPairs
|
557 | */
|
558 | fromPairs(): Object<Dictionary<T extends [PropertyName, infer U] ? U : any>>;
|
559 | }
|
560 | interface CollectionChain<T> {
|
561 | /**
|
562 | * @see _.fromPairs
|
563 | */
|
564 | fromPairs(): ObjectChain<Dictionary<T extends [PropertyName, infer U] ? U : any>>;
|
565 | }
|
566 | interface LoDashStatic {
|
567 | /**
|
568 | * Gets the first element of array.
|
569 | *
|
570 | * @alias _.first
|
571 | *
|
572 | * @param array The array to query.
|
573 | * @return Returns the first element of array.
|
574 | */
|
575 | head<T>(array: List<T> | null | undefined): T | undefined;
|
576 | }
|
577 | interface String {
|
578 | /**
|
579 | * @see _.head
|
580 | */
|
581 | head(): string | undefined;
|
582 | }
|
583 | interface StringChain {
|
584 | /**
|
585 | * @see _.head
|
586 | */
|
587 | head(): StringNullableChain;
|
588 | }
|
589 | interface StringNullableChain {
|
590 | /**
|
591 | * @see _.head
|
592 | */
|
593 | head(): StringNullableChain;
|
594 | }
|
595 | interface Collection<T> {
|
596 | /**
|
597 | * @see _.head
|
598 | */
|
599 | head(): T | undefined;
|
600 | }
|
601 | interface CollectionChain<T> {
|
602 | /**
|
603 | * @see _.head
|
604 | */
|
605 | head(): ExpChain<T | undefined>;
|
606 | }
|
607 | interface LoDashStatic {
|
608 | /**
|
609 | * Gets the index at which the first occurrence of `value` is found in `array`
|
610 | * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
611 | * for equality comparisons. If `fromIndex` is negative, it's used as the offset
|
612 | * from the end of `array`.
|
613 | *
|
614 | * @category Array
|
615 | * @param array The array to search.
|
616 | * @param value The value to search for.
|
617 | * @param [fromIndex=0] The index to search from.
|
618 | * @returns Returns the index of the matched value, else `-1`.
|
619 | * @example
|
620 | *
|
621 | * _.indexOf([1, 2, 1, 2], 2);
|
622 | * // => 1
|
623 | *
|
624 | * // using `fromIndex`
|
625 | * _.indexOf([1, 2, 1, 2], 2, 2);
|
626 | * // => 3
|
627 | */
|
628 | indexOf<T>(array: List<T> | null | undefined, value: T, fromIndex?: number): number;
|
629 | }
|
630 | interface Collection<T> {
|
631 | /**
|
632 | * @see _.indexOf
|
633 | */
|
634 | indexOf(value: T, fromIndex?: number): number;
|
635 | }
|
636 | interface CollectionChain<T> {
|
637 | /**
|
638 | * @see _.indexOf
|
639 | */
|
640 | indexOf(value: T, fromIndex?: number): PrimitiveChain<number>;
|
641 | }
|
642 | interface LoDashStatic {
|
643 | /**
|
644 | * Gets all but the last element of array.
|
645 | *
|
646 | * @param array The array to query.
|
647 | * @return Returns the slice of array.
|
648 | */
|
649 | initial<T>(array: List<T> | null | undefined): T[];
|
650 | }
|
651 | interface Collection<T> {
|
652 | /**
|
653 | * @see _.initial
|
654 | */
|
655 | initial(): Collection<T>;
|
656 | }
|
657 | interface CollectionChain<T> {
|
658 | /**
|
659 | * @see _.initial
|
660 | */
|
661 | initial(): CollectionChain<T>;
|
662 | }
|
663 | interface LoDashStatic {
|
664 | /**
|
665 | * Creates an array of unique values that are included in all of the provided arrays using SameValueZero for
|
666 | * equality comparisons.
|
667 | *
|
668 | * @param arrays The arrays to inspect.
|
669 | * @return Returns the new array of shared values.
|
670 | */
|
671 | intersection<T>(...arrays: Array<List<T>>): T[];
|
672 | }
|
673 | interface Collection<T> {
|
674 | /**
|
675 | * @see _.intersection
|
676 | */
|
677 | intersection(...arrays: Array<List<T>>): Collection<T>;
|
678 | }
|
679 | interface CollectionChain<T> {
|
680 | /**
|
681 | * @see _.intersection
|
682 | */
|
683 | intersection(...arrays: Array<List<T>>): CollectionChain<T>;
|
684 | }
|
685 | interface LoDashStatic {
|
686 | /**
|
687 | * This method is like `_.intersection` except that it accepts `iteratee`
|
688 | * which is invoked for each element of each `arrays` to generate the criterion
|
689 | * by which uniqueness is computed. The iteratee is invoked with one argument: (value).
|
690 | *
|
691 | * @category Array
|
692 | * @param [arrays] The arrays to inspect.
|
693 | * @param [iteratee=_.identity] The iteratee invoked per element.
|
694 | * @returns Returns the new array of shared values.
|
695 | * @example
|
696 | *
|
697 | * _.intersectionBy([2.1, 1.2], [4.3, 2.4], Math.floor);
|
698 | * // => [2.1]
|
699 | *
|
700 | * // using the `_.property` iteratee shorthand
|
701 | * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
|
702 | * // => [{ 'x': 1 }]
|
703 | */
|
704 | intersectionBy<T1, T2>(array: List<T1> | null, values: List<T2>, iteratee: ValueIteratee<T1 | T2>): T1[];
|
705 | /**
|
706 | * @see _.intersectionBy
|
707 | */
|
708 | intersectionBy<T1, T2, T3>(array: List<T1> | null, values1: List<T2>, values2: List<T3>, iteratee: ValueIteratee<T1 | T2 | T3>): T1[];
|
709 | /**
|
710 | * @see _.intersectionBy
|
711 | */
|
712 | 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[];
|
713 | /**
|
714 | * @see _.intersectionBy
|
715 | */
|
716 | intersectionBy<T>(array?: List<T> | null, ...values: Array<List<T>>): T[];
|
717 | /**
|
718 | * @see _.intersectionBy
|
719 | */
|
720 | intersectionBy<T>(...values: Array<List<T> | ValueIteratee<T>>): T[];
|
721 | }
|
722 | interface Collection<T> {
|
723 | /**
|
724 | * @see _.intersectionBy
|
725 | */
|
726 | intersectionBy<T2>(values: List<T2>, iteratee: ValueIteratee<T | T2>): Collection<T>;
|
727 | /**
|
728 | * @see _.intersectionBy
|
729 | */
|
730 | intersectionBy(...values: Array<List<unknown> | ValueIteratee<T>>): Collection<T>;
|
731 | }
|
732 | interface CollectionChain<T> {
|
733 | /**
|
734 | * @see _.intersectionBy
|
735 | */
|
736 | intersectionBy<T2>(values: List<T2>, iteratee: ValueIteratee<T | T2>): CollectionChain<T>;
|
737 | /**
|
738 | * @see _.intersectionBy
|
739 | */
|
740 | intersectionBy(...values: Array<List<unknown> | ValueIteratee<T>>): CollectionChain<T>;
|
741 | }
|
742 | interface LoDashStatic {
|
743 | /**
|
744 | * Creates an array of unique `array` values not included in the other
|
745 | * provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
746 | * for equality comparisons.
|
747 | *
|
748 | * @category Array
|
749 | * @param [values] The arrays to inspect.
|
750 | * @param [comparator] The comparator invoked per element.
|
751 | * @returns Returns the new array of filtered values.
|
752 | * @example
|
753 | *
|
754 | * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
|
755 | * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
|
756 |
|
757 | * _.intersectionWith(objects, others, _.isEqual);
|
758 | * // => [{ 'x': 1, 'y': 2 }]
|
759 | */
|
760 | intersectionWith<T1, T2>(array: List<T1> | null | undefined, values: List<T2>, comparator: Comparator2<T1, T2>): T1[];
|
761 | /**
|
762 | * @see _.intersectionWith
|
763 | */
|
764 | intersectionWith<T1, T2, T3>(array: List<T1> | null | undefined, values1: List<T2>, values2: List<T3>, comparator: Comparator2<T1, T2 | T3>): T1[];
|
765 | /**
|
766 | * @see _.intersectionWith
|
767 | */
|
768 | 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[];
|
769 | /**
|
770 | * @see _.intersectionWith
|
771 | */
|
772 | intersectionWith<T>(array?: List<T> | null, ...values: Array<List<T>>): T[];
|
773 | }
|
774 | interface Collection<T> {
|
775 | /**
|
776 | * @see _.intersectionWith
|
777 | */
|
778 | intersectionWith<T2>(values: List<T2>, comparator: Comparator2<T, T2>): Collection<T>;
|
779 | /**
|
780 | * @see _.intersectionWith
|
781 | */
|
782 | intersectionWith(...values: Array<List<unknown> | Comparator2<T, never>>): Collection<T>;
|
783 | }
|
784 | interface CollectionChain<T> {
|
785 | /**
|
786 | * @see _.intersectionWith
|
787 | */
|
788 | intersectionWith<T2>(values: List<T2>, comparator: Comparator2<T, T2>): CollectionChain<T>;
|
789 | /**
|
790 | * @see _.intersectionWith
|
791 | */
|
792 | intersectionWith(...values: Array<List<unknown> | Comparator2<T, never>>): CollectionChain<T>;
|
793 | }
|
794 | interface LoDashStatic {
|
795 | /**
|
796 | * Converts all elements in `array` into a string separated by `separator`.
|
797 | *
|
798 | * @param array The array to convert.
|
799 | * @param separator The element separator.
|
800 | * @returns Returns the joined string.
|
801 | */
|
802 | join(array: List<any> | null | undefined, separator?: string): string;
|
803 | }
|
804 | interface String {
|
805 | /**
|
806 | * @see _.join
|
807 | */
|
808 | join(separator?: string): string;
|
809 | }
|
810 | interface StringChain {
|
811 | /**
|
812 | * @see _.join
|
813 | */
|
814 | join(separator?: string): StringChain;
|
815 | }
|
816 | interface StringNullableChain {
|
817 | /**
|
818 | * @see _.join
|
819 | */
|
820 | join(separator?: string): StringChain;
|
821 | }
|
822 | interface Collection<T> {
|
823 | /**
|
824 | * @see _.join
|
825 | */
|
826 | join(separator?: string): string;
|
827 | }
|
828 | interface CollectionChain<T> {
|
829 | /**
|
830 | * @see _.join
|
831 | */
|
832 | join(separator?: string): StringChain;
|
833 | }
|
834 | interface LoDashStatic {
|
835 | /**
|
836 | * Gets the last element of array.
|
837 | *
|
838 | * @param array The array to query.
|
839 | * @return Returns the last element of array.
|
840 | */
|
841 | last<T>(array: List<T> | null | undefined): T | undefined;
|
842 | }
|
843 | interface Collection<T> {
|
844 | /**
|
845 | * @see _.last
|
846 | */
|
847 | last(): T | undefined;
|
848 | }
|
849 | interface CollectionChain<T> {
|
850 | /**
|
851 | * @see _.last
|
852 | */
|
853 | last(): ExpChain<T | undefined>;
|
854 | }
|
855 | interface String {
|
856 | /**
|
857 | * @see _.last
|
858 | */
|
859 | last(): string | undefined;
|
860 | }
|
861 | interface StringChain {
|
862 | /**
|
863 | * @see _.last
|
864 | */
|
865 | last(): StringNullableChain;
|
866 | }
|
867 | interface StringNullableChain {
|
868 | /**
|
869 | * @see _.last
|
870 | */
|
871 | last(): StringNullableChain;
|
872 | }
|
873 | interface LoDashStatic {
|
874 | /**
|
875 | * This method is like _.indexOf except that it iterates over elements of array from right to left.
|
876 | *
|
877 | * @param array The array to search.
|
878 | * @param value The value to search for.
|
879 | * @param fromIndex The index to search from or true to perform a binary search on a sorted array.
|
880 | * @return Returns the index of the matched value, else -1.
|
881 | */
|
882 | lastIndexOf<T>(array: List<T> | null | undefined, value: T, fromIndex?: true|number): number;
|
883 | }
|
884 | interface Collection<T> {
|
885 | /**
|
886 | * @see _.lastIndexOf
|
887 | */
|
888 | lastIndexOf(value: T, fromIndex?: true|number): number;
|
889 | }
|
890 | interface CollectionChain<T> {
|
891 | /**
|
892 | * @see _.lastIndexOf
|
893 | */
|
894 | lastIndexOf(value: T, fromIndex?: true|number): PrimitiveChain<number>;
|
895 | }
|
896 | interface LoDashStatic {
|
897 | /**
|
898 | * Gets the element at index `n` of `array`. If `n` is negative, the nth element from the end is returned.
|
899 | *
|
900 | * @param array array The array to query.
|
901 | * @param value The index of the element to return.
|
902 | * @return Returns the nth element of `array`.
|
903 | */
|
904 | nth<T>(array: List<T> | null | undefined, n?: number): T | undefined;
|
905 | }
|
906 | interface Collection<T> {
|
907 | /**
|
908 | * @see _.nth
|
909 | */
|
910 | nth(n?: number): T | undefined;
|
911 | }
|
912 | interface CollectionChain<T> {
|
913 | /**
|
914 | * @see _.nth
|
915 | */
|
916 | nth(n?: number): ExpChain<T | undefined>;
|
917 | }
|
918 | interface LoDashStatic {
|
919 | /**
|
920 | * Removes all provided values from array using SameValueZero for equality comparisons.
|
921 | *
|
922 | * Note: Unlike _.without, this method mutates array.
|
923 | *
|
924 | * @param array The array to modify.
|
925 | * @param values The values to remove.
|
926 | * @return Returns array.
|
927 | */
|
928 | pull<T>(array: T[], ...values: T[]): T[];
|
929 | /**
|
930 | * @see _.pull
|
931 | */
|
932 | pull<T>(array: List<T>, ...values: T[]): List<T>;
|
933 | }
|
934 | interface Collection<T> {
|
935 | /**
|
936 | * @see _.pull
|
937 | */
|
938 | pull(...values: T[]): Collection<T>;
|
939 | }
|
940 | interface CollectionChain<T> {
|
941 | /**
|
942 | * @see _.pull
|
943 | */
|
944 | pull(...values: T[]): CollectionChain<T>;
|
945 | }
|
946 | interface LoDashStatic {
|
947 | /**
|
948 | * This method is like `_.pull` except that it accepts an array of values to remove.
|
949 | *
|
950 | * **Note:** Unlike `_.difference`, this method mutates `array`.
|
951 | *
|
952 | * @category Array
|
953 | * @param array The array to modify.
|
954 | * @param values The values to remove.
|
955 | * @returns Returns `array`.
|
956 | * @example
|
957 | *
|
958 | * var array = [1, 2, 3, 1, 2, 3];
|
959 | *
|
960 | * _.pull(array, [2, 3]);
|
961 | * console.log(array);
|
962 | * // => [1, 1]
|
963 | */
|
964 | pullAll<T>(array: T[], values?: List<T>): T[];
|
965 | /**
|
966 | * @see _.pullAll
|
967 | */
|
968 | pullAll<T>(array: List<T>, values?: List<T>): List<T>;
|
969 | }
|
970 | interface Collection<T> {
|
971 | /**
|
972 | * @see _.pullAll
|
973 | */
|
974 | pullAll(values?: List<T>): Collection<T>;
|
975 | }
|
976 | interface CollectionChain<T> {
|
977 | /**
|
978 | * @see _.pullAll
|
979 | */
|
980 | pullAll(values?: List<T>): CollectionChain<T>;
|
981 | }
|
982 | interface LoDashStatic {
|
983 | /**
|
984 | * This method is like `_.pullAll` except that it accepts `iteratee` which is
|
985 | * invoked for each element of `array` and `values` to to generate the criterion
|
986 | * by which uniqueness is computed. The iteratee is invoked with one argument: (value).
|
987 | *
|
988 | * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
|
989 | *
|
990 | * @category Array
|
991 | * @param array The array to modify.
|
992 | * @param values The values to remove.
|
993 | * @param [iteratee=_.identity] The iteratee invoked per element.
|
994 | * @returns Returns `array`.
|
995 | * @example
|
996 | *
|
997 | * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
|
998 | *
|
999 | * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
|
1000 | * console.log(array);
|
1001 | * // => [{ 'x': 2 }]
|
1002 | */
|
1003 | pullAllBy<T>(array: T[], values?: List<T>, iteratee?: ValueIteratee<T>): T[];
|
1004 | /**
|
1005 | * @see _.pullAllBy
|
1006 | */
|
1007 | pullAllBy<T>(array: List<T>, values?: List<T>, iteratee?: ValueIteratee<T>): List<T>;
|
1008 | /**
|
1009 | * @see _.pullAllBy
|
1010 | */
|
1011 | pullAllBy<T1, T2>(array: T1[], values: List<T2>, iteratee: ValueIteratee<T1 | T2>): T1[];
|
1012 | /**
|
1013 | * @see _.pullAllBy
|
1014 | */
|
1015 | pullAllBy<T1, T2>(array: List<T1>, values: List<T2>, iteratee: ValueIteratee<T1 | T2>): List<T1>;
|
1016 | }
|
1017 | interface Collection<T> {
|
1018 | /**
|
1019 | * @see _.pullAllBy
|
1020 | */
|
1021 | pullAllBy<T2>(values?: List<T2>, iteratee?: ValueIteratee<T | T2>): Collection<T>;
|
1022 | }
|
1023 | interface CollectionChain<T> {
|
1024 | /**
|
1025 | * @see _.pullAllBy
|
1026 | */
|
1027 | pullAllBy<T2>(values?: List<T2>, iteratee?: ValueIteratee<T | T2>): CollectionChain<T>;
|
1028 | }
|
1029 | interface LoDashStatic {
|
1030 | /**
|
1031 | * This method is like `_.pullAll` except that it accepts `comparator` which is
|
1032 | * invoked to compare elements of array to values. The comparator is invoked with
|
1033 | * two arguments: (arrVal, othVal).
|
1034 | *
|
1035 | * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
|
1036 | *
|
1037 | * @category Array
|
1038 | * @param array The array to modify.
|
1039 | * @param values The values to remove.
|
1040 | * @param [iteratee=_.identity] The iteratee invoked per element.
|
1041 | * @returns Returns `array`.
|
1042 | * @example
|
1043 | *
|
1044 | * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
|
1045 | *
|
1046 | * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
|
1047 | * console.log(array);
|
1048 | * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
|
1049 | */
|
1050 | pullAllWith<T>(array: T[], values?: List<T>, comparator?: Comparator<T>): T[];
|
1051 | /**
|
1052 | * @see _.pullAllWith
|
1053 | */
|
1054 | pullAllWith<T>(array: List<T>, values?: List<T>, comparator?: Comparator<T>): List<T>;
|
1055 | /**
|
1056 | * @see _.pullAllWith
|
1057 | */
|
1058 | pullAllWith<T1, T2>(array: T1[], values: List<T2>, comparator: Comparator2<T1, T2>): T1[];
|
1059 | /**
|
1060 | * @see _.pullAllWith
|
1061 | */
|
1062 | pullAllWith<T1, T2>(array: List<T1>, values: List<T2>, comparator: Comparator2<T1, T2>): List<T1>;
|
1063 | }
|
1064 | interface Collection<T> {
|
1065 | /**
|
1066 | * @see _.pullAllWith
|
1067 | */
|
1068 | pullAllWith<T2>(values?: List<T2>, comparator?: Comparator2<T, T2>): Collection<T>;
|
1069 | }
|
1070 | interface CollectionChain<T> {
|
1071 | /**
|
1072 | * @see _.pullAllWith
|
1073 | */
|
1074 | pullAllWith<T2>(values?: List<T2>, comparator?: Comparator2<T, T2>): CollectionChain<T>;
|
1075 | }
|
1076 | interface LoDashStatic {
|
1077 | /**
|
1078 | * Removes elements from array corresponding to the given indexes and returns an array of the removed elements.
|
1079 | * Indexes may be specified as an array of indexes or as individual arguments.
|
1080 | *
|
1081 | * Note: Unlike _.at, this method mutates array.
|
1082 | *
|
1083 | * @param array The array to modify.
|
1084 | * @param indexes The indexes of elements to remove, specified as individual indexes or arrays of indexes.
|
1085 | * @return Returns the new array of removed elements.
|
1086 | */
|
1087 | pullAt<T>(array: T[], ...indexes: Array<Many<number>>): T[];
|
1088 | /**
|
1089 | * @see _.pullAt
|
1090 | */
|
1091 | pullAt<T>(array: List<T>, ...indexes: Array<Many<number>>): List<T>;
|
1092 | }
|
1093 | interface Collection<T> {
|
1094 | /**
|
1095 | * @see _.pullAt
|
1096 | */
|
1097 | pullAt(...indexes: Array<Many<number>>): Collection<T>;
|
1098 | }
|
1099 | interface CollectionChain<T> {
|
1100 | /**
|
1101 | * @see _.pullAt
|
1102 | */
|
1103 | pullAt(...indexes: Array<Many<number>>): CollectionChain<T>;
|
1104 | }
|
1105 | interface LoDashStatic {
|
1106 | /**
|
1107 | * Removes all elements from array that predicate returns truthy for and returns an array of the removed
|
1108 | * elements. The predicate is invoked with three arguments: (value, index, array).
|
1109 | *
|
1110 | * Note: Unlike _.filter, this method mutates array.
|
1111 | *
|
1112 | * @param array The array to modify.
|
1113 | * @param predicate The function invoked per iteration.
|
1114 | * @return Returns the new array of removed elements.
|
1115 | */
|
1116 | remove<T>(array: List<T>, predicate?: ListIteratee<T>): T[];
|
1117 | }
|
1118 | interface Collection<T> {
|
1119 | /**
|
1120 | * @see _.remove
|
1121 | */
|
1122 | remove(predicate?: ListIteratee<T>): Collection<T>;
|
1123 | }
|
1124 | interface CollectionChain<T> {
|
1125 | /**
|
1126 | * @see _.remove
|
1127 | */
|
1128 | remove(predicate?: ListIteratee<T>): CollectionChain<T>;
|
1129 | }
|
1130 | interface LoDashStatic {
|
1131 | /**
|
1132 | * Reverses `array` so that the first element becomes the last, the second
|
1133 | * element becomes the second to last, and so on.
|
1134 | *
|
1135 | * **Note:** This method mutates `array` and is based on
|
1136 | * [`Array#reverse`](https://mdn.io/Array/reverse).
|
1137 | *
|
1138 | * @category Array
|
1139 | * @returns Returns `array`.
|
1140 | * @example
|
1141 | *
|
1142 | * var array = [1, 2, 3];
|
1143 | *
|
1144 | * _.reverse(array);
|
1145 | * // => [3, 2, 1]
|
1146 | *
|
1147 | * console.log(array);
|
1148 | * // => [3, 2, 1]
|
1149 | */
|
1150 | reverse<TList extends List<any>>(array: TList): TList;
|
1151 | }
|
1152 | interface LoDashStatic {
|
1153 | /**
|
1154 | * Creates a slice of array from start up to, but not including, end.
|
1155 | *
|
1156 | * @param array The array to slice.
|
1157 | * @param start The start position.
|
1158 | * @param end The end position.
|
1159 | * @return Returns the slice of array.
|
1160 | */
|
1161 | slice<T>(array: List<T> | null | undefined, start?: number, end?: number): T[];
|
1162 | }
|
1163 | interface Collection<T> {
|
1164 | /**
|
1165 | * @see _.slice
|
1166 | */
|
1167 | slice(start?: number, end?: number): Collection<T>;
|
1168 | }
|
1169 | interface CollectionChain<T> {
|
1170 | /**
|
1171 | * @see _.slice
|
1172 | */
|
1173 | slice(start?: number, end?: number): CollectionChain<T>;
|
1174 | }
|
1175 | interface LoDashStatic {
|
1176 | /**
|
1177 | * Uses a binary search to determine the lowest index at which `value` should
|
1178 | * be inserted into `array` in order to maintain its sort order.
|
1179 | *
|
1180 | * @category Array
|
1181 | * @param array The sorted array to inspect.
|
1182 | * @param value The value to evaluate.
|
1183 | * @returns Returns the index at which `value` should be inserted into `array`.
|
1184 | * @example
|
1185 | *
|
1186 | * _.sortedIndex([30, 50], 40);
|
1187 | * // => 1
|
1188 | *
|
1189 | * _.sortedIndex([4, 5], 4);
|
1190 | * // => 0
|
1191 | */
|
1192 | sortedIndex<T>(array: List<T> | null | undefined, value: T): number;
|
1193 | }
|
1194 | interface Collection<T> {
|
1195 | /**
|
1196 | * @see _.sortedIndex
|
1197 | */
|
1198 | sortedIndex(value: T): number;
|
1199 | }
|
1200 | interface CollectionChain<T> {
|
1201 | /**
|
1202 | * @see _.sortedIndex
|
1203 | */
|
1204 | sortedIndex(value: T): PrimitiveChain<number>;
|
1205 | }
|
1206 | interface LoDashStatic {
|
1207 | /**
|
1208 | * Uses a binary search to determine the lowest index at which `value` should
|
1209 | * be inserted into `array` in order to maintain its sort order.
|
1210 | *
|
1211 | * @category Array
|
1212 | * @param array The sorted array to inspect.
|
1213 | * @param value The value to evaluate.
|
1214 | * @returns Returns the index at which `value` should be inserted into `array`.
|
1215 | * @example
|
1216 | *
|
1217 | * _.sortedIndex([30, 50], 40);
|
1218 | * // => 1
|
1219 | *
|
1220 | * _.sortedIndex([4, 5], 4);
|
1221 | * // => 0
|
1222 | */
|
1223 | sortedIndex<T>(array: List<T> | null | undefined, value: T): number;
|
1224 | }
|
1225 | interface Collection<T> {
|
1226 | /**
|
1227 | * @see _.sortedIndex
|
1228 | */
|
1229 | sortedIndex(value: T): number;
|
1230 | }
|
1231 | interface CollectionChain<T> {
|
1232 | /**
|
1233 | * @see _.sortedIndex
|
1234 | */
|
1235 | sortedIndex(value: T): PrimitiveChain<number>;
|
1236 | }
|
1237 | interface LoDashStatic {
|
1238 | /**
|
1239 | * This method is like `_.sortedIndex` except that it accepts `iteratee`
|
1240 | * which is invoked for `value` and each element of `array` to compute their
|
1241 | * sort ranking. The iteratee is invoked with one argument: (value).
|
1242 | *
|
1243 | * @category Array
|
1244 | * @param array The sorted array to inspect.
|
1245 | * @param value The value to evaluate.
|
1246 | * @param [iteratee=_.identity] The iteratee invoked per element.
|
1247 | * @returns Returns the index at which `value` should be inserted into `array`.
|
1248 | * @example
|
1249 | *
|
1250 | * var dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 };
|
1251 | *
|
1252 | * _.sortedIndexBy(['thirty', 'fifty'], 'forty', _.propertyOf(dict));
|
1253 | * // => 1
|
1254 | *
|
1255 | * // using the `_.property` iteratee shorthand
|
1256 | * _.sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x');
|
1257 | * // => 0
|
1258 | */
|
1259 | sortedIndexBy<T>(array: List<T> | null | undefined, value: T, iteratee?: ValueIteratee<T>): number;
|
1260 | }
|
1261 | interface Collection<T> {
|
1262 | /**
|
1263 | * @see _.sortedIndexBy
|
1264 | */
|
1265 | sortedIndexBy(value: T, iteratee?: ValueIteratee<T>): number;
|
1266 | }
|
1267 | interface CollectionChain<T> {
|
1268 | /**
|
1269 | * @see _.sortedIndexBy
|
1270 | */
|
1271 | sortedIndexBy(value: T, iteratee?: ValueIteratee<T>): PrimitiveChain<number>;
|
1272 | }
|
1273 | interface LoDashStatic {
|
1274 | /**
|
1275 | * This method is like `_.indexOf` except that it performs a binary
|
1276 | * search on a sorted `array`.
|
1277 | *
|
1278 | * @category Array
|
1279 | * @param array The array to search.
|
1280 | * @param value The value to search for.
|
1281 | * @returns Returns the index of the matched value, else `-1`.
|
1282 | * @example
|
1283 | *
|
1284 | * _.sortedIndexOf([1, 1, 2, 2], 2);
|
1285 | * // => 2
|
1286 | */
|
1287 | sortedIndexOf<T>(array: List<T> | null | undefined, value: T): number;
|
1288 | }
|
1289 | interface Collection<T> {
|
1290 | /**
|
1291 | * @see _.sortedIndexOf
|
1292 | */
|
1293 | sortedIndexOf(value: T): number;
|
1294 | }
|
1295 | interface CollectionChain<T> {
|
1296 | /**
|
1297 | * @see _.sortedIndexOf
|
1298 | */
|
1299 | sortedIndexOf(value: T): PrimitiveChain<number>;
|
1300 | }
|
1301 | interface LoDashStatic {
|
1302 | /**
|
1303 | * This method is like `_.sortedIndex` except that it returns the highest
|
1304 | * index at which `value` should be inserted into `array` in order to
|
1305 | * maintain its sort order.
|
1306 | *
|
1307 | * @category Array
|
1308 | * @param array The sorted array to inspect.
|
1309 | * @param value The value to evaluate.
|
1310 | * @returns Returns the index at which `value` should be inserted into `array`.
|
1311 | * @example
|
1312 | *
|
1313 | * _.sortedLastIndex([4, 5], 4);
|
1314 | * // => 1
|
1315 | */
|
1316 | sortedLastIndex<T>(array: List<T> | null | undefined, value: T): number;
|
1317 | }
|
1318 | interface Collection<T> {
|
1319 | /**
|
1320 | * @see _.sortedLastIndex
|
1321 | */
|
1322 | sortedLastIndex(value: T): number;
|
1323 | }
|
1324 | interface CollectionChain<T> {
|
1325 | /**
|
1326 | * @see _.sortedLastIndex
|
1327 | */
|
1328 | sortedLastIndex(value: T): PrimitiveChain<number>;
|
1329 | }
|
1330 | interface LoDashStatic {
|
1331 | /**
|
1332 | * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
|
1333 | * which is invoked for `value` and each element of `array` to compute their
|
1334 | * sort ranking. The iteratee is invoked with one argument: (value).
|
1335 | *
|
1336 | * @category Array
|
1337 | * @param array The sorted array to inspect.
|
1338 | * @param value The value to evaluate.
|
1339 | * @param [iteratee=_.identity] The iteratee invoked per element.
|
1340 | * @returns Returns the index at which `value` should be inserted into `array`.
|
1341 | * @example
|
1342 | *
|
1343 | * // using the `_.property` iteratee shorthand
|
1344 | * _.sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x');
|
1345 | * // => 1
|
1346 | */
|
1347 | sortedLastIndexBy<T>(array: List<T> | null | undefined, value: T, iteratee: ValueIteratee<T>): number;
|
1348 | }
|
1349 | interface Collection<T> {
|
1350 | /**
|
1351 | * @see _.sortedLastIndexBy
|
1352 | */
|
1353 | sortedLastIndexBy(value: T, iteratee: ValueIteratee<T>): number;
|
1354 | }
|
1355 | interface CollectionChain<T> {
|
1356 | /**
|
1357 | * @see _.sortedLastIndexBy
|
1358 | */
|
1359 | sortedLastIndexBy(value: T, iteratee: ValueIteratee<T>): PrimitiveChain<number>;
|
1360 | }
|
1361 | interface LoDashStatic {
|
1362 | /**
|
1363 | * This method is like `_.lastIndexOf` except that it performs a binary
|
1364 | * search on a sorted `array`.
|
1365 | *
|
1366 | * @category Array
|
1367 | * @param array The array to search.
|
1368 | * @param value The value to search for.
|
1369 | * @returns Returns the index of the matched value, else `-1`.
|
1370 | * @example
|
1371 | *
|
1372 | * _.sortedLastIndexOf([1, 1, 2, 2], 2);
|
1373 | * // => 3
|
1374 | */
|
1375 | sortedLastIndexOf<T>(array: List<T> | null | undefined, value: T): number;
|
1376 | }
|
1377 | interface Collection<T> {
|
1378 | /**
|
1379 | * @see _.sortedLastIndexOf
|
1380 | */
|
1381 | sortedLastIndexOf(value: T): number;
|
1382 | }
|
1383 | interface CollectionChain<T> {
|
1384 | /**
|
1385 | * @see _.sortedLastIndexOf
|
1386 | */
|
1387 | sortedLastIndexOf(value: T): PrimitiveChain<number>;
|
1388 | }
|
1389 | interface LoDashStatic {
|
1390 | /**
|
1391 | * This method is like `_.uniq` except that it's designed and optimized
|
1392 | * for sorted arrays.
|
1393 | *
|
1394 | * @category Array
|
1395 | * @param array The array to inspect.
|
1396 | * @returns Returns the new duplicate free array.
|
1397 | * @example
|
1398 | *
|
1399 | * _.sortedUniq([1, 1, 2]);
|
1400 | * // => [1, 2]
|
1401 | */
|
1402 | sortedUniq<T>(array: List<T> | null | undefined): T[];
|
1403 | }
|
1404 | interface Collection<T> {
|
1405 | /**
|
1406 | * @see _.sortedUniq
|
1407 | */
|
1408 | sortedUniq(): Collection<T>;
|
1409 | }
|
1410 | interface CollectionChain<T> {
|
1411 | /**
|
1412 | * @see _.sortedUniq
|
1413 | */
|
1414 | sortedUniq(): CollectionChain<T>;
|
1415 | }
|
1416 | interface LoDashStatic {
|
1417 | /**
|
1418 | * This method is like `_.uniqBy` except that it's designed and optimized
|
1419 | * for sorted arrays.
|
1420 | *
|
1421 | * @category Array
|
1422 | * @param array The array to inspect.
|
1423 | * @param [iteratee] The iteratee invoked per element.
|
1424 | * @returns Returns the new duplicate free array.
|
1425 | * @example
|
1426 | *
|
1427 | * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
|
1428 | * // => [1.1, 2.2]
|
1429 | */
|
1430 | sortedUniqBy<T>(array: List<T> | null | undefined, iteratee: ValueIteratee<T>): T[];
|
1431 | }
|
1432 | interface Collection<T> {
|
1433 | /**
|
1434 | * @see _.sortedUniqBy
|
1435 | */
|
1436 | sortedUniqBy(iteratee: ValueIteratee<T>): Collection<T>;
|
1437 | }
|
1438 | interface CollectionChain<T> {
|
1439 | /**
|
1440 | * @see _.sortedUniqBy
|
1441 | */
|
1442 | sortedUniqBy(iteratee: ValueIteratee<T>): CollectionChain<T>;
|
1443 | }
|
1444 | interface LoDashStatic {
|
1445 | /**
|
1446 | * Gets all but the first element of array.
|
1447 | *
|
1448 | * @param array The array to query.
|
1449 | * @return Returns the slice of array.
|
1450 | */
|
1451 | tail<T>(array: List<T> | null | undefined): T[];
|
1452 | }
|
1453 | interface Collection<T> {
|
1454 | /**
|
1455 | * @see _.tail
|
1456 | */
|
1457 | tail(): Collection<T>;
|
1458 | }
|
1459 | interface CollectionChain<T> {
|
1460 | /**
|
1461 | * @see _.tail
|
1462 | */
|
1463 | tail(): CollectionChain<T>;
|
1464 | }
|
1465 | interface LoDashStatic {
|
1466 | /**
|
1467 | * Creates a slice of array with n elements taken from the beginning.
|
1468 | *
|
1469 | * @param array The array to query.
|
1470 | * @param n The number of elements to take.
|
1471 | * @return Returns the slice of array.
|
1472 | */
|
1473 | take<T>(array: List<T> | null | undefined, n?: number): T[];
|
1474 | }
|
1475 | interface Collection<T> {
|
1476 | /**
|
1477 | * @see _.take
|
1478 | */
|
1479 | take(n?: number): Collection<T>;
|
1480 | }
|
1481 | interface CollectionChain<T> {
|
1482 | /**
|
1483 | * @see _.take
|
1484 | */
|
1485 | take(n?: number): CollectionChain<T>;
|
1486 | }
|
1487 | interface LoDashStatic {
|
1488 | /**
|
1489 | * Creates a slice of array with n elements taken from the end.
|
1490 | *
|
1491 | * @param array The array to query.
|
1492 | * @param n The number of elements to take.
|
1493 | * @return Returns the slice of array.
|
1494 | */
|
1495 | takeRight<T>(array: List<T> | null | undefined, n?: number): T[];
|
1496 | }
|
1497 | interface Collection<T> {
|
1498 | /**
|
1499 | * @see _.takeRight
|
1500 | */
|
1501 | takeRight(n?: number): Collection<T>;
|
1502 | }
|
1503 | interface CollectionChain<T> {
|
1504 | /**
|
1505 | * @see _.takeRight
|
1506 | */
|
1507 | takeRight(n?: number): CollectionChain<T>;
|
1508 | }
|
1509 | interface LoDashStatic {
|
1510 | /**
|
1511 | * Creates a slice of array with elements taken from the end. Elements are taken until predicate returns
|
1512 | * falsey. The predicate is invoked with three arguments: (value, index, array).
|
1513 | *
|
1514 | * @param array The array to query.
|
1515 | * @param predicate The function invoked per iteration.
|
1516 | * @return Returns the slice of array.
|
1517 | */
|
1518 | takeRightWhile<T>(array: List<T> | null | undefined, predicate?: ListIteratee<T>): T[];
|
1519 | }
|
1520 | interface Collection<T> {
|
1521 | /**
|
1522 | * @see _.takeRightWhile
|
1523 | */
|
1524 | takeRightWhile(predicate?: ListIteratee<T>): Collection<T>;
|
1525 | }
|
1526 | interface CollectionChain<T> {
|
1527 | /**
|
1528 | * @see _.takeRightWhile
|
1529 | */
|
1530 | takeRightWhile(predicate?: ListIteratee<T>): CollectionChain<T>;
|
1531 | }
|
1532 | interface LoDashStatic {
|
1533 | /**
|
1534 | * Creates a slice of array with elements taken from the beginning. Elements are taken until predicate returns
|
1535 | * falsey. The predicate is invoked with three arguments: (value, index, array).
|
1536 | *
|
1537 | * @param array The array to query.
|
1538 | * @param predicate The function invoked per iteration.
|
1539 | * @return Returns the slice of array.
|
1540 | */
|
1541 | takeWhile<T>(array: List<T> | null | undefined, predicate?: ListIteratee<T>): T[];
|
1542 | }
|
1543 | interface Collection<T> {
|
1544 | /**
|
1545 | * @see _.takeWhile
|
1546 | */
|
1547 | takeWhile(predicate?: ListIteratee<T>): Collection<T>;
|
1548 | }
|
1549 | interface CollectionChain<T> {
|
1550 | /**
|
1551 | * @see _.takeWhile
|
1552 | */
|
1553 | takeWhile(predicate?: ListIteratee<T>): CollectionChain<T>;
|
1554 | }
|
1555 | interface LoDashStatic {
|
1556 | /**
|
1557 | * Creates an array of unique values, in order, from all of the provided arrays using SameValueZero for
|
1558 | * equality comparisons.
|
1559 | *
|
1560 | * @param arrays The arrays to inspect.
|
1561 | * @return Returns the new array of combined values.
|
1562 | */
|
1563 | union<T>(...arrays: Array<List<T> | null | undefined>): T[];
|
1564 | }
|
1565 | interface Collection<T> {
|
1566 | /**
|
1567 | * @see _.union
|
1568 | */
|
1569 | union(...arrays: Array<List<T> | null | undefined>): Collection<T>;
|
1570 | }
|
1571 | interface CollectionChain<T> {
|
1572 | /**
|
1573 | * @see _.union
|
1574 | */
|
1575 | union(...arrays: Array<List<T> | null | undefined>): CollectionChain<T>;
|
1576 | }
|
1577 | interface LoDashStatic {
|
1578 | /**
|
1579 | * This method is like `_.union` except that it accepts `iteratee` which is
|
1580 | * invoked for each element of each `arrays` to generate the criterion by which
|
1581 | * uniqueness is computed. The iteratee is invoked with one argument: (value).
|
1582 | *
|
1583 | * @param arrays The arrays to inspect.
|
1584 | * @param iteratee The iteratee invoked per element.
|
1585 | * @return Returns the new array of combined values.
|
1586 | */
|
1587 | unionBy<T>(arrays: List<T> | null | undefined, iteratee?: ValueIteratee<T>): T[];
|
1588 | /**
|
1589 | * @see _.unionBy
|
1590 | */
|
1591 | unionBy<T>(arrays1: List<T> | null | undefined, arrays2: 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, arrays3: 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, arrays4: 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, arrays5: List<T> | null | undefined, ...iteratee: Array<ValueIteratee<T> | List<T> | null | undefined>): T[];
|
1604 | }
|
1605 | interface Collection<T> {
|
1606 | /**
|
1607 | * @see _.unionBy
|
1608 | */
|
1609 | unionBy(arrays2: List<T> | null | undefined, iteratee?: ValueIteratee<T>): Collection<T>;
|
1610 | /**
|
1611 | * @see _.unionBy
|
1612 | */
|
1613 | unionBy(...iteratee: Array<ValueIteratee<T> | List<T> | null | undefined>): Collection<T>;
|
1614 | }
|
1615 | interface CollectionChain<T> {
|
1616 | /**
|
1617 | * @see _.unionBy
|
1618 | */
|
1619 | unionBy(arrays2: List<T> | null | undefined, iteratee?: ValueIteratee<T>): CollectionChain<T>;
|
1620 | /**
|
1621 | * @see _.unionBy
|
1622 | */
|
1623 | unionBy(...iteratee: Array<ValueIteratee<T> | List<T> | null | undefined>): CollectionChain<T>;
|
1624 | }
|
1625 | interface LoDashStatic {
|
1626 | /**
|
1627 | * This method is like `_.union` except that it accepts `comparator` which
|
1628 | * is invoked to compare elements of `arrays`. The comparator is invoked
|
1629 | * with two arguments: (arrVal, othVal).
|
1630 | *
|
1631 | * @category Array
|
1632 | * @param [arrays] The arrays to inspect.
|
1633 | * @param [comparator] The comparator invoked per element.
|
1634 | * @returns Returns the new array of combined values.
|
1635 | * @example
|
1636 | *
|
1637 | * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
|
1638 | * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
|
1639 | *
|
1640 | * _.unionWith(objects, others, _.isEqual);
|
1641 | * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
|
1642 | */
|
1643 | unionWith<T>(arrays: List<T> | null | undefined, comparator?: Comparator<T>): T[];
|
1644 | /**
|
1645 | * @see _.unionWith
|
1646 | */
|
1647 | unionWith<T>(arrays: List<T> | null | undefined, arrays2: 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, arrays3: List<T> | null | undefined, ...comparator: Array<Comparator<T> | List<T> | null | undefined>): T[];
|
1652 | }
|
1653 | interface Collection<T> {
|
1654 | /**
|
1655 | * @see _.unionWith
|
1656 | */
|
1657 | unionWith(arrays2: List<T> | null | undefined, comparator?: Comparator<T>): Collection<T>;
|
1658 | /**
|
1659 | * @see _.unionWith
|
1660 | */
|
1661 | unionWith(...comparator: Array<Comparator<T> | List<T> | null | undefined>): Collection<T>;
|
1662 | }
|
1663 | interface CollectionChain<T> {
|
1664 | /**
|
1665 | * @see _.unionWith
|
1666 | */
|
1667 | unionWith(arrays2: List<T> | null | undefined, comparator?: Comparator<T>): CollectionChain<T>;
|
1668 | /**
|
1669 | * @see _.unionWith
|
1670 | */
|
1671 | unionWith(...comparator: Array<Comparator<T> | List<T> | null | undefined>): CollectionChain<T>;
|
1672 | }
|
1673 | interface LoDashStatic {
|
1674 | /**
|
1675 | * Creates a duplicate-free version of an array, using
|
1676 | * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
1677 | * for equality comparisons, in which only the first occurrence of each element
|
1678 | * is kept.
|
1679 | *
|
1680 | * @category Array
|
1681 | * @param array The array to inspect.
|
1682 | * @returns Returns the new duplicate free array.
|
1683 | * @example
|
1684 | *
|
1685 | * _.uniq([2, 1, 2]);
|
1686 | * // => [2, 1]
|
1687 | */
|
1688 | uniq<T>(array: List<T> | null | undefined): T[];
|
1689 | }
|
1690 | interface Collection<T> {
|
1691 | /**
|
1692 | * @see _.uniq
|
1693 | */
|
1694 | uniq(): Collection<T>;
|
1695 | }
|
1696 | interface CollectionChain<T> {
|
1697 | /**
|
1698 | * @see _.uniq
|
1699 | */
|
1700 | uniq(): CollectionChain<T>;
|
1701 | }
|
1702 | interface LoDashStatic {
|
1703 | /**
|
1704 | * This method is like `_.uniq` except that it accepts `iteratee` which is
|
1705 | * invoked for each element in `array` to generate the criterion by which
|
1706 | * uniqueness is computed. The iteratee is invoked with one argument: (value).
|
1707 | *
|
1708 | * @category Array
|
1709 | * @param array The array to inspect.
|
1710 | * @param [iteratee=_.identity] The iteratee invoked per element.
|
1711 | * @returns Returns the new duplicate free array.
|
1712 | * @example
|
1713 | *
|
1714 | * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
|
1715 | * // => [2.1, 1.2]
|
1716 | *
|
1717 | * // using the `_.property` iteratee shorthand
|
1718 | * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
|
1719 | * // => [{ 'x': 1 }, { 'x': 2 }]
|
1720 | */
|
1721 | uniqBy<T>(array: List<T> | null | undefined, iteratee: ValueIteratee<T>): T[];
|
1722 | }
|
1723 | interface Collection<T> {
|
1724 | /**
|
1725 | * @see _.uniqBy
|
1726 | */
|
1727 | uniqBy(iteratee: ValueIteratee<T>): Collection<T>;
|
1728 | }
|
1729 | interface CollectionChain<T> {
|
1730 | /**
|
1731 | * @see _.uniqBy
|
1732 | */
|
1733 | uniqBy(iteratee: ValueIteratee<T>): CollectionChain<T>;
|
1734 | }
|
1735 | interface LoDashStatic {
|
1736 | /**
|
1737 | * This method is like `_.uniq` except that it accepts `comparator` which
|
1738 | * is invoked to compare elements of `array`. The comparator is invoked with
|
1739 | * two arguments: (arrVal, othVal).
|
1740 | *
|
1741 | * @category Array
|
1742 | * @param array The array to inspect.
|
1743 | * @param [comparator] The comparator invoked per element.
|
1744 | * @returns Returns the new duplicate free array.
|
1745 | * @example
|
1746 | *
|
1747 | * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
|
1748 | *
|
1749 | * _.uniqWith(objects, _.isEqual);
|
1750 | * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
|
1751 | */
|
1752 | uniqWith<T>(array: List<T> | null | undefined, comparator?: Comparator<T>): T[];
|
1753 | }
|
1754 | interface Collection<T> {
|
1755 | /**
|
1756 | * @see _.uniqWith
|
1757 | */
|
1758 | uniqWith(comparator?: Comparator<T>): Collection<T>;
|
1759 | }
|
1760 | interface CollectionChain<T> {
|
1761 | /**
|
1762 | * @see _.uniqWith
|
1763 | */
|
1764 | uniqWith(comparator?: Comparator<T>): CollectionChain<T>;
|
1765 | }
|
1766 | interface LoDashStatic {
|
1767 | /**
|
1768 | * This method is like _.zip except that it accepts an array of grouped elements and creates an array
|
1769 | * regrouping the elements to their pre-zip configuration.
|
1770 | *
|
1771 | * @param array The array of grouped elements to process.
|
1772 | * @return Returns the new array of regrouped elements.
|
1773 | */
|
1774 | unzip<T>(array: T[][] | List<List<T>> | null | undefined): T[][];
|
1775 | }
|
1776 | interface Collection<T> {
|
1777 | /**
|
1778 | * @see _.unzip
|
1779 | */
|
1780 | unzip(): T extends List<infer U> ? Collection<U[]> : unknown;
|
1781 | }
|
1782 | interface CollectionChain<T> {
|
1783 | /**
|
1784 | * @see _.unzip
|
1785 | */
|
1786 | unzip(): T extends List<infer U> ? CollectionChain<U[]> : unknown;
|
1787 | }
|
1788 | interface LoDashStatic {
|
1789 | /**
|
1790 | * This method is like _.unzip except that it accepts an iteratee to specify how regrouped values should be
|
1791 | * combined. The iteratee is invoked with four arguments: (accumulator, value, index, group).
|
1792 | *
|
1793 | * @param array The array of grouped elements to process.
|
1794 | * @param iteratee The function to combine regrouped values.
|
1795 | * @return Returns the new array of regrouped elements.
|
1796 | */
|
1797 | unzipWith<T, TResult>(array: List<List<T>> | null | undefined, iteratee: (...values: T[]) => TResult): TResult[];
|
1798 | /**
|
1799 | * @see _.unzipWith
|
1800 | */
|
1801 | unzipWith<T>(array: List<List<T>> | null | undefined): T[][];
|
1802 | }
|
1803 | interface Collection<T> {
|
1804 | /**
|
1805 | * @see _.unzipWith
|
1806 | */
|
1807 | unzipWith<TResult>(iteratee: (...values: Array<T extends List<infer U> ? U : unknown>) => TResult): Collection<TResult>;
|
1808 | /**
|
1809 | * @see _.unzipWith
|
1810 | */
|
1811 | unzipWith(): T extends List<infer U> ? Collection<U[]> : unknown;
|
1812 | }
|
1813 | interface CollectionChain<T> {
|
1814 | /**
|
1815 | * @see _.unzipWith
|
1816 | */
|
1817 | unzipWith<TResult>(iteratee: (...values: Array<T extends List<infer U> ? U : unknown>) => TResult): CollectionChain<TResult>;
|
1818 | /**
|
1819 | * @see _.unzipWith
|
1820 | */
|
1821 | unzipWith(): T extends List<infer U> ? CollectionChain<U[]> : unknown;
|
1822 | }
|
1823 | interface LoDashStatic {
|
1824 | /**
|
1825 | * Creates an array excluding all provided values using SameValueZero for equality comparisons.
|
1826 | *
|
1827 | * @param array The array to filter.
|
1828 | * @param values The values to exclude.
|
1829 | * @return Returns the new array of filtered values.
|
1830 | */
|
1831 | without<T>(array: List<T> | null | undefined, ...values: T[]): T[];
|
1832 | }
|
1833 | interface Collection<T> {
|
1834 | /**
|
1835 | * @see _.without
|
1836 | */
|
1837 | without(...values: T[]): Collection<T>;
|
1838 | }
|
1839 | interface CollectionChain<T> {
|
1840 | /**
|
1841 | * @see _.without
|
1842 | */
|
1843 | without(...values: T[]): CollectionChain<T>;
|
1844 | }
|
1845 | interface LoDashStatic {
|
1846 | /**
|
1847 | * Creates an array of unique values that is the symmetric difference of the provided arrays.
|
1848 | *
|
1849 | * @param arrays The arrays to inspect.
|
1850 | * @return Returns the new array of values.
|
1851 | */
|
1852 | xor<T>(...arrays: Array<List<T> | null | undefined>): T[];
|
1853 | }
|
1854 | interface Collection<T> {
|
1855 | /**
|
1856 | * @see _.xor
|
1857 | */
|
1858 | xor(...arrays: Array<List<T> | null | undefined>): Collection<T>;
|
1859 | }
|
1860 | interface CollectionChain<T> {
|
1861 | /**
|
1862 | * @see _.xor
|
1863 | */
|
1864 | xor(...arrays: Array<List<T> | null | undefined>): CollectionChain<T>;
|
1865 | }
|
1866 | interface LoDashStatic {
|
1867 | /**
|
1868 | * This method is like `_.xor` except that it accepts `iteratee` which is
|
1869 | * invoked for each element of each `arrays` to generate the criterion by which
|
1870 | * uniqueness is computed. The iteratee is invoked with one argument: (value).
|
1871 | *
|
1872 | * @category Array
|
1873 | * @param [arrays] The arrays to inspect.
|
1874 | * @param [iteratee=_.identity] The iteratee invoked per element.
|
1875 | * @returns Returns the new array of values.
|
1876 | * @example
|
1877 | *
|
1878 | * _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor);
|
1879 | * // => [1.2, 4.3]
|
1880 | *
|
1881 | * // using the `_.property` iteratee shorthand
|
1882 | * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
|
1883 | * // => [{ 'x': 2 }]
|
1884 | */
|
1885 | xorBy<T>(arrays: List<T> | null | undefined, iteratee?: ValueIteratee<T>): T[];
|
1886 | /**
|
1887 | * @see _.xorBy
|
1888 | */
|
1889 | xorBy<T>(arrays: List<T> | null | undefined, arrays2: 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, arrays3: List<T> | null | undefined, ...iteratee: Array<ValueIteratee<T> | List<T> | null | undefined>): T[];
|
1894 | }
|
1895 | interface Collection<T> {
|
1896 | /**
|
1897 | * @see _.xorBy
|
1898 | */
|
1899 | xorBy(arrays2: List<T> | null | undefined, iteratee?: ValueIteratee<T>): Collection<T>;
|
1900 | /**
|
1901 | * @see _.xorBy
|
1902 | */
|
1903 | xorBy(...iteratee: Array<ValueIteratee<T> | List<T> | null | undefined>): Collection<T>;
|
1904 | }
|
1905 | interface CollectionChain<T> {
|
1906 | /**
|
1907 | * @see _.xorBy
|
1908 | */
|
1909 | xorBy(arrays2: List<T> | null | undefined, iteratee?: ValueIteratee<T>): CollectionChain<T>;
|
1910 | /**
|
1911 | * @see _.xorBy
|
1912 | */
|
1913 | xorBy(...iteratee: Array<ValueIteratee<T> | List<T> | null | undefined>): CollectionChain<T>;
|
1914 | }
|
1915 | interface LoDashStatic {
|
1916 | /**
|
1917 | * This method is like `_.xor` except that it accepts `comparator` which is
|
1918 | * invoked to compare elements of `arrays`. The comparator is invoked with
|
1919 | * two arguments: (arrVal, othVal).
|
1920 | *
|
1921 | * @category Array
|
1922 | * @param [arrays] The arrays to inspect.
|
1923 | * @param [comparator] The comparator invoked per element.
|
1924 | * @returns Returns the new array of values.
|
1925 | * @example
|
1926 | *
|
1927 | * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
|
1928 | * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
|
1929 | *
|
1930 | * _.xorWith(objects, others, _.isEqual);
|
1931 | * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
|
1932 | */
|
1933 | xorWith<T>(arrays: List<T> | null | undefined, comparator?: Comparator<T>): T[];
|
1934 | /**
|
1935 | * @see _.xorWith
|
1936 | */
|
1937 | xorWith<T>(arrays: List<T> | null | undefined, arrays2: 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, arrays3: List<T> | null | undefined, ...comparator: Array<Comparator<T> | List<T> | null | undefined>): T[];
|
1942 | }
|
1943 | interface Collection<T> {
|
1944 | /**
|
1945 | * @see _.xorWith
|
1946 | */
|
1947 | xorWith(arrays2: List<T> | null | undefined, comparator?: Comparator<T>): Collection<T>;
|
1948 | /**
|
1949 | * @see _.xorWith
|
1950 | */
|
1951 | xorWith(...comparator: Array<Comparator<T> | List<T> | null | undefined>): Collection<T>;
|
1952 | }
|
1953 | interface CollectionChain<T> {
|
1954 | /**
|
1955 | * @see _.xorWith
|
1956 | */
|
1957 | xorWith(arrays2: List<T> | null | undefined, comparator?: Comparator<T>): CollectionChain<T>;
|
1958 | /**
|
1959 | * @see _.xorWith
|
1960 | */
|
1961 | xorWith(...comparator: Array<Comparator<T> | List<T> | null | undefined>): CollectionChain<T>;
|
1962 | }
|
1963 | interface LoDashStatic {
|
1964 | /**
|
1965 | * Creates an array of grouped elements, the first of which contains the first elements of the given arrays,
|
1966 | * the second of which contains the second elements of the given arrays, and so on.
|
1967 | *
|
1968 | * @param arrays The arrays to process.
|
1969 | * @return Returns the new array of grouped elements.
|
1970 | */
|
1971 | zip<T1, T2>(arrays1: List<T1>, arrays2: List<T2>): Array<[T1 | undefined, T2 | undefined]>;
|
1972 | /**
|
1973 | * @see _.zip
|
1974 | */
|
1975 | zip<T1, T2, T3>(arrays1: List<T1>, arrays2: List<T2>, arrays3: List<T3>): Array<[T1 | undefined, T2 | undefined, T3 | undefined]>;
|
1976 | /**
|
1977 | * @see _.zip
|
1978 | */
|
1979 | 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]>;
|
1980 | /**
|
1981 | * @see _.zip
|
1982 | */
|
1983 | 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]>;
|
1984 | /**
|
1985 | * @see _.zip
|
1986 | */
|
1987 | zip<T>(...arrays: Array<List<T> | null | undefined>): Array<Array<T | undefined>>;
|
1988 | }
|
1989 | interface Collection<T> {
|
1990 | /**
|
1991 | * @see _.zip
|
1992 | */
|
1993 | zip<T2>(arrays2: List<T2>): Collection<[T | undefined, T2 | undefined]>;
|
1994 | /**
|
1995 | * @see _.zip
|
1996 | */
|
1997 | zip(...arrays: Array<List<T> | null | undefined>): Collection<Array<T | undefined>>;
|
1998 | }
|
1999 | interface CollectionChain<T> {
|
2000 | /**
|
2001 | * @see _.zip
|
2002 | */
|
2003 | zip<T2>(arrays2: List<T2>): CollectionChain<[T | undefined, T2 | undefined]>;
|
2004 | /**
|
2005 | * @see _.zip
|
2006 | */
|
2007 | zip(...arrays: Array<List<T> | null | undefined>): CollectionChain<Array<T | undefined>>;
|
2008 | }
|
2009 | interface LoDashStatic {
|
2010 | /**
|
2011 | * This method is like _.fromPairs except that it accepts two arrays, one of property
|
2012 | * identifiers and one of corresponding values.
|
2013 | *
|
2014 | * @param props The property names.
|
2015 | * @param values The property values.
|
2016 | * @return Returns the new object.
|
2017 | */
|
2018 | zipObject<T>(props: List<PropertyName>, values: List<T>): Dictionary<T>;
|
2019 | /**
|
2020 | * @see _.zipObject
|
2021 | */
|
2022 | zipObject(props?: List<PropertyName>): Dictionary<undefined>;
|
2023 | }
|
2024 | interface Collection<T> {
|
2025 | /**
|
2026 | * @see _.zipObject
|
2027 | */
|
2028 | zipObject<U>(values: List<U>): Object<Dictionary<U>>;
|
2029 | /**
|
2030 | * @see _.zipObject
|
2031 | */
|
2032 | zipObject(): Object<Dictionary<undefined>>;
|
2033 | }
|
2034 | interface CollectionChain<T> {
|
2035 | /**
|
2036 | * @see _.zipObject
|
2037 | */
|
2038 | zipObject<U>(values: List<U>): ObjectChain<Dictionary<U>>;
|
2039 | /**
|
2040 | * @see _.zipObject
|
2041 | */
|
2042 | zipObject(): ObjectChain<Dictionary<undefined>>;
|
2043 | }
|
2044 | interface LoDashStatic {
|
2045 | /**
|
2046 | * This method is like _.zipObject except that it supports property paths.
|
2047 | *
|
2048 | * @param paths The property names.
|
2049 | * @param values The property values.
|
2050 | * @return Returns the new object.
|
2051 | */
|
2052 | zipObjectDeep(paths?: List<PropertyPath>, values?: List<any>): object;
|
2053 | }
|
2054 | interface Collection<T> {
|
2055 | /**
|
2056 | * @see _.zipObjectDeep
|
2057 | */
|
2058 | zipObjectDeep(values?: List<any>): Object<object>;
|
2059 | }
|
2060 | interface CollectionChain<T> {
|
2061 | /**
|
2062 | * @see _.zipObjectDeep
|
2063 | */
|
2064 | zipObjectDeep(values?: List<any>): ObjectChain<object>;
|
2065 | }
|
2066 | interface LoDashStatic {
|
2067 | /**
|
2068 | * This method is like _.zip except that it accepts an iteratee to specify how grouped values should be
|
2069 | * combined. The iteratee is invoked with four arguments: (accumulator, value, index,
|
2070 | * group).
|
2071 | * @param arrays The arrays to process.
|
2072 | * @param iteratee The function to combine grouped values.
|
2073 | * @return Returns the new array of grouped elements.
|
2074 | */
|
2075 | zipWith<T, TResult>(arrays: List<T>, iteratee: (value1: T) => TResult): TResult[];
|
2076 | /**
|
2077 | * @see _.zipWith
|
2078 | */
|
2079 | zipWith<T1, T2, TResult>(arrays1: List<T1>, arrays2: List<T2>, iteratee: (value1: T1, value2: T2) => TResult): TResult[];
|
2080 | /**
|
2081 | * @see _.zipWith
|
2082 | */
|
2083 | zipWith<T1, T2, T3, TResult>(arrays1: List<T1>, arrays2: List<T2>, arrays3: List<T3>, iteratee: (value1: T1, value2: T2, value3: T3) => TResult): TResult[];
|
2084 | /**
|
2085 | * @see _.zipWith
|
2086 | */
|
2087 | 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[];
|
2088 | /**
|
2089 | * @see _.zipWith
|
2090 | */
|
2091 | 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[];
|
2092 | /**
|
2093 | * @see _.zipWith
|
2094 | */
|
2095 | zipWith<T, TResult>(...iteratee: Array<((...group: T[]) => TResult) | List<T> | null | undefined>): TResult[];
|
2096 | }
|
2097 | interface Collection<T> {
|
2098 | /**
|
2099 | * @see _.zipWith
|
2100 | */
|
2101 | zipWith<T2, TResult>(arrays2: List<T2>, iteratee: (value1: T, value2: T2) => TResult): Collection<TResult>;
|
2102 | /**
|
2103 | * @see _.zipWith
|
2104 | */
|
2105 | zipWith<T2, T3, TResult>(arrays2: List<T2>, arrays3: List<T3>, iteratee: (value1: T, value2: T2, value3: T3) => TResult): Collection<TResult>;
|
2106 | /**
|
2107 | * @see _.zipWith
|
2108 | */
|
2109 | zipWith<TResult>(...iteratee: Array<((...group: T[]) => TResult) | List<T> | null | undefined>): Collection<TResult>;
|
2110 | }
|
2111 | interface CollectionChain<T> {
|
2112 | /**
|
2113 | * @see _.zipWith
|
2114 | */
|
2115 | zipWith<T2, TResult>(arrays2: List<T2>, iteratee: (value1: T, value2: T2) => TResult): CollectionChain<TResult>;
|
2116 | /**
|
2117 | * @see _.zipWith
|
2118 | */
|
2119 | zipWith<T2, T3, TResult>(arrays2: List<T2>, arrays3: List<T3>, iteratee: (value1: T, value2: T2, value3: T3) => TResult): CollectionChain<TResult>;
|
2120 | /**
|
2121 | * @see _.zipWith
|
2122 | */
|
2123 | zipWith<TResult>(...iteratee: Array<((...group: T[]) => TResult) | List<T> | null | undefined>): CollectionChain<TResult>;
|
2124 | }
|
2125 | }
|
2126 |
|
\ | No newline at end of file |