UNPKG

67.9 kBTypeScriptView Raw
1import _ = require("../index");
2declare module "../index" {
3 interface LoDashStatic {
4 /**
5 * Creates an object composed of keys generated from the results of running each element of collection through
6 * iteratee. The corresponding value of each key is the number of times the key was returned by iteratee. The
7 * iteratee is invoked with one argument: (value).
8 *
9 * @param collection The collection to iterate over.
10 * @param iteratee The function invoked per iteration.
11 * @return Returns the composed aggregate object.
12 */
13 countBy<T>(collection: List<T> | null | undefined, iteratee?: ValueIteratee<T>): Dictionary<number>;
14 /**
15 * @see _.countBy
16 */
17 countBy<T extends object>(collection: T | null | undefined, iteratee?: ValueIteratee<T[keyof T]>): Dictionary<number>;
18 }
19 interface Object<T> {
20 /**
21 * @see _.countBy
22 */
23 countBy(iteratee?: ValueIteratee<T[keyof T]>): Object<Dictionary<number>>;
24 }
25 interface String {
26 /**
27 * @see _.countBy
28 */
29 countBy(iteratee?: ValueIteratee<string>): Object<Dictionary<number>>;
30 }
31 interface Collection<T> {
32 /**
33 * @see _.countBy
34 */
35 countBy(iteratee?: ValueIteratee<T>): Object<Dictionary<number>>;
36 }
37 interface ObjectChain<T> {
38 /**
39 * @see _.countBy
40 */
41 countBy(iteratee?: ValueIteratee<T[keyof T]>): ObjectChain<Dictionary<number>>;
42 }
43 interface StringChain {
44 /**
45 * @see _.countBy
46 */
47 countBy(iteratee?: ValueIteratee<string>): ObjectChain<Dictionary<number>>;
48 }
49 interface StringNullableChain {
50 /**
51 * @see _.countBy
52 */
53 countBy(iteratee?: ValueIteratee<string>): ObjectChain<Dictionary<number>>;
54 }
55 interface CollectionChain<T> {
56 /**
57 * @see _.countBy
58 */
59 countBy(iteratee?: ValueIteratee<T>): ObjectChain<Dictionary<number>>;
60 }
61 interface LoDashStatic {
62 /**
63 * @see _.forEach
64 */
65 each: LoDashStatic['forEach'];
66 }
67 interface String {
68 /**
69 * @see _.each
70 */
71 each: String['forEach'];
72 }
73 interface Collection<T> {
74 /**
75 * @see _.each
76 */
77 each: Collection<T>['forEach'];
78 }
79 interface Object<T> {
80 /**
81 * @see _.each
82 */
83 each: Object<T>['forEach'];
84 }
85 interface StringChain {
86 /**
87 * @see _.each
88 */
89 each: StringChain['forEach'];
90 }
91 interface StringNullableChain {
92 /**
93 * @see _.each
94 */
95 each: StringNullableChain['forEach'];
96 }
97 interface CollectionChain<T> {
98 /**
99 * @see _.each
100 */
101 each: CollectionChain<T>['forEach'];
102 }
103 interface ObjectChain<T> {
104 /**
105 * @see _.each
106 */
107 each: ObjectChain<T>['forEach'];
108 }
109 interface LoDashStatic {
110 /**
111 * @see _.forEachRight
112 */
113 eachRight: LoDashStatic["forEachRight"];
114 }
115 interface String {
116 /**
117 * @see _.eachRight
118 */
119 eachRight: String['forEachRight'];
120 }
121 interface Collection<T> {
122 /**
123 * @see _.eachRight
124 */
125 eachRight: Collection<T>['forEachRight'];
126 }
127 interface Object<T> {
128 /**
129 * @see _.eachRight
130 */
131 eachRight: Object<T>['forEachRight'];
132 }
133 interface StringChain {
134 /**
135 * @see _.eachRight
136 */
137 eachRight: StringChain['forEachRight'];
138 }
139 interface StringNullableChain {
140 /**
141 * @see _.eachRight
142 */
143 eachRight: StringNullableChain['forEachRight'];
144 }
145 interface CollectionChain<T> {
146 /**
147 * @see _.eachRight
148 */
149 eachRight: CollectionChain<T>['forEachRight'];
150 }
151 interface ObjectChain<T> {
152 /**
153 * @see _.eachRight
154 */
155 eachRight: ObjectChain<T>['forEachRight'];
156 }
157 interface LoDashStatic {
158 /**
159 * Checks if predicate returns truthy for all elements of collection. Iteration is stopped once predicate
160 * returns falsey. The predicate is invoked with three arguments: (value, index|key, collection).
161 *
162 * @param collection The collection to iterate over.
163 * @param predicate The function invoked per iteration.
164 * @return Returns true if all elements pass the predicate check, else false.
165 */
166 every<T>(collection: List<T> | null | undefined, predicate?: ListIterateeCustom<T, boolean>): boolean;
167 /**
168 * @see _.every
169 */
170 every<T extends object>(collection: T | null | undefined, predicate?: ObjectIterateeCustom<T, boolean>): boolean;
171 }
172 interface Collection<T> {
173 /**
174 * @see _.every
175 */
176 every(predicate?: ListIterateeCustom<T, boolean>): boolean;
177 }
178 interface Object<T> {
179 /**
180 * @see _.every
181 */
182 every(predicate?: ObjectIterateeCustom<T, boolean>): boolean;
183 }
184 interface CollectionChain<T> {
185 /**
186 * @see _.every
187 */
188 every(predicate?: ListIterateeCustom<T, boolean>): PrimitiveChain<boolean>;
189 }
190 interface ObjectChain<T> {
191 /**
192 * @see _.every
193 */
194 every(predicate?: ObjectIterateeCustom<T, boolean>): PrimitiveChain<boolean>;
195 }
196 interface LoDashStatic {
197 /**
198 * Iterates over elements of collection, returning an array of all elements predicate returns truthy for. The
199 * predicate is invoked with three arguments: (value, index|key, collection).
200 *
201 * @param collection The collection to iterate over.
202 * @param predicate The function invoked per iteration.
203 * @return Returns the new filtered array.
204 */
205 filter(collection: string | null | undefined, predicate?: StringIterator<boolean>): string[];
206 /**
207 * @see _.filter
208 */
209 filter<T, S extends T>(collection: List<T> | null | undefined, predicate: ListIteratorTypeGuard<T, S>): S[];
210 /**
211 * @see _.filter
212 */
213 filter<T>(collection: List<T> | null | undefined, predicate?: ListIterateeCustom<T, boolean>): T[];
214 /**
215 * @see _.filter
216 */
217 filter<T extends object, S extends T[keyof T]>(collection: T | null | undefined, predicate: ObjectIteratorTypeGuard<T, S>): S[];
218 /**
219 * @see _.filter
220 */
221 filter<T extends object>(collection: T | null | undefined, predicate?: ObjectIterateeCustom<T, boolean>): Array<T[keyof T]>;
222 }
223 interface String {
224 /**
225 * @see _.filter
226 */
227 filter(predicate?: StringIterator<boolean>): Collection<string>;
228 }
229 interface Collection<T> {
230 /**
231 * @see _.filter
232 */
233 filter<S extends T>(predicate: ListIteratorTypeGuard<T, S>): Collection<S>;
234 /**
235 * @see _.filter
236 */
237 filter(predicate?: ListIterateeCustom<T, boolean>): Collection<T>;
238 }
239 interface Object<T> {
240 /**
241 * @see _.filter
242 */
243 filter<S extends T[keyof T]>(predicate: ObjectIteratorTypeGuard<T, S>): Collection<S>;
244 /**
245 * @see _.filter
246 */
247 filter(predicate?: ObjectIterateeCustom<T, boolean>): Collection<T[keyof T]>;
248 }
249 interface StringChain {
250 /**
251 * @see _.filter
252 */
253 filter(predicate?: StringIterator<boolean>): CollectionChain<string>;
254 }
255 interface StringNullableChain {
256 /**
257 * @see _.filter
258 */
259 filter(predicate?: StringIterator<boolean>): CollectionChain<string>;
260 }
261 interface CollectionChain<T> {
262 /**
263 * @see _.filter
264 */
265 filter<S extends T>(predicate: ListIteratorTypeGuard<T, S>): CollectionChain<S>;
266 /**
267 * @see _.filter
268 */
269 filter(predicate?: ListIterateeCustom<T, boolean>): CollectionChain<T>;
270 }
271 interface ObjectChain<T> {
272 /**
273 * @see _.filter
274 */
275 filter<S extends T[keyof T]>(predicate: ObjectIteratorTypeGuard<T, S>): CollectionChain<S>;
276 /**
277 * @see _.filter
278 */
279 filter(predicate?: ObjectIterateeCustom<T, boolean>): CollectionChain<T[keyof T]>;
280 }
281 interface LoDashStatic {
282 /**
283 * Iterates over elements of collection, returning the first element predicate returns truthy for.
284 * The predicate is invoked with three arguments: (value, index|key, collection).
285 *
286 * @param collection The collection to search.
287 * @param predicate The function invoked per iteration.
288 * @param fromIndex The index to search from.
289 * @return Returns the matched element, else undefined.
290 */
291 find<T, S extends T>(collection: List<T> | null | undefined, predicate: ListIteratorTypeGuard<T, S>, fromIndex?: number): S|undefined;
292 /**
293 * @see _.find
294 */
295 find<T>(collection: List<T> | null | undefined, predicate?: ListIterateeCustom<T, boolean>, fromIndex?: number): T|undefined;
296 /**
297 * @see _.find
298 */
299 find<T extends object, S extends T[keyof T]>(collection: T | null | undefined, predicate: ObjectIteratorTypeGuard<T, S>, fromIndex?: number): S|undefined;
300 /**
301 * @see _.find
302 */
303 find<T extends object>(collection: T | null | undefined, predicate?: ObjectIterateeCustom<T, boolean>, fromIndex?: number): T[keyof T]|undefined;
304 }
305 interface Collection<T> {
306 /**
307 * @see _.find
308 */
309 find<S extends T>(predicate: ListIteratorTypeGuard<T, S>, fromIndex?: number): S|undefined;
310 /**
311 * @see _.find
312 */
313 find(predicate?: ListIterateeCustom<T, boolean>, fromIndex?: number): T|undefined;
314 }
315 interface Object<T> {
316 /**
317 * @see _.find
318 */
319 find< S extends T[keyof T]>(predicate: ObjectIteratorTypeGuard<T, S>, fromIndex?: number): S|undefined;
320 /**
321 * @see _.find
322 */
323 find(predicate?: ObjectIterateeCustom<T, boolean>, fromIndex?: number): T[keyof T]|undefined;
324 }
325 interface CollectionChain<T> {
326 /**
327 * @see _.find
328 */
329 find< S extends T>(predicate: ListIteratorTypeGuard<T, S>, fromIndex?: number): ExpChain<S|undefined>;
330 /**
331 * @see _.find
332 */
333 find(predicate?: ListIterateeCustom<T, boolean>, fromIndex?: number): ExpChain<T|undefined>;
334 }
335 interface ObjectChain<T> {
336 /**
337 * @see _.find
338 */
339 find< S extends T[keyof T]>(predicate: ObjectIteratorTypeGuard<T, S>, fromIndex?: number): ExpChain<S|undefined>;
340 /**
341 * @see _.find
342 */
343 find(predicate?: ObjectIterateeCustom<T, boolean>, fromIndex?: number): ExpChain<T[keyof T]|undefined>;
344 }
345 interface LoDashStatic {
346 /**
347 * This method is like _.find except that it iterates over elements of a collection from
348 * right to left.
349 * @param collection Searches for a value in this list.
350 * @param predicate The function called per iteration.
351 * @param fromIndex The index to search from.
352 * @return The found element, else undefined.
353 */
354 findLast<T, S extends T>(collection: List<T> | null | undefined, predicate: ListIteratorTypeGuard<T, S>, fromIndex?: number): S|undefined;
355 /**
356 * @see _.findLast
357 */
358 findLast<T>(collection: List<T> | null | undefined, predicate?: ListIterateeCustom<T, boolean>, fromIndex?: number): T|undefined;
359 /**
360 * @see _.findLast
361 */
362 findLast<T extends object, S extends T[keyof T]>(collection: T | null | undefined, predicate: ObjectIteratorTypeGuard<T, S>, fromIndex?: number): S|undefined;
363 /**
364 * @see _.findLast
365 */
366 findLast<T extends object>(collection: T | null | undefined, predicate?: ObjectIterateeCustom<T, boolean>, fromIndex?: number): T[keyof T]|undefined;
367 }
368 interface Collection<T> {
369 /**
370 * @see _.findLast
371 */
372 findLast<S extends T>(predicate: ListIteratorTypeGuard<T, S>, fromIndex?: number): S|undefined;
373 /**
374 * @see _.findLast
375 */
376 findLast(predicate?: ListIterateeCustom<T, boolean>, fromIndex?: number): T|undefined;
377 }
378 interface Object<T> {
379 /**
380 * @see _.findLast
381 */
382 findLast< S extends T[keyof T]>(predicate: ObjectIteratorTypeGuard<T, S>, fromIndex?: number): S|undefined;
383 /**
384 * @see _.findLast
385 */
386 findLast(predicate?: ObjectIterateeCustom<T, boolean>, fromIndex?: number): T[keyof T]|undefined;
387 }
388 interface CollectionChain<T> {
389 /**
390 * @see _.findLast
391 */
392 findLast< S extends T>(predicate: ListIteratorTypeGuard<T, S>, fromIndex?: number): ExpChain<S|undefined>;
393 /**
394 * @see _.findLast
395 */
396 findLast(predicate?: ListIterateeCustom<T, boolean>, fromIndex?: number): ExpChain<T|undefined>;
397 }
398 interface ObjectChain<T> {
399 /**
400 * @see _.findLast
401 */
402 findLast< S extends T[keyof T]>(predicate: ObjectIteratorTypeGuard<T, S>, fromIndex?: number): ExpChain<S|undefined>;
403 /**
404 * @see _.findLast
405 */
406 findLast(predicate?: ObjectIterateeCustom<T, boolean>, fromIndex?: number): ExpChain<T[keyof T]|undefined>;
407 }
408 interface LoDashStatic {
409 /**
410 * Creates an array of flattened values by running each element in collection through iteratee
411 * and concating its result to the other mapped values. The iteratee is invoked with three arguments:
412 * (value, index|key, collection).
413 *
414 * @param collection The collection to iterate over.
415 * @param iteratee The function invoked per iteration.
416 * @return Returns the new flattened array.
417 */
418 flatMap<T>(collection: Dictionary<Many<T>> | NumericDictionary<Many<T>> | null | undefined): T[];
419 /**
420 * @see _.flatMap
421 */
422 flatMap(collection: object | null | undefined): any[];
423 /**
424 * @see _.flatMap
425 */
426 flatMap<T, TResult>(collection: List<T> | null | undefined, iteratee: ListIterator<T, Many<TResult>>): TResult[];
427 /**
428 * @see _.flatMap
429 */
430 flatMap<T extends object, TResult>(collection: T | null | undefined, iteratee: ObjectIterator<T, Many<TResult>>): TResult[];
431 /**
432 * @see _.flatMap
433 */
434 flatMap(collection: object | null | undefined, iteratee: string): any[];
435 /**
436 * @see _.flatMap
437 */
438 flatMap(collection: object | null | undefined, iteratee: object): boolean[];
439 }
440 interface String {
441 /**
442 * @see _.flatMap
443 */
444 flatMap<TResult>(iteratee: StringIterator<Many<TResult>>): Collection<TResult>;
445 /**
446 * @see _.flatMap
447 */
448 flatMap(): Collection<string>;
449 }
450 interface Collection<T> {
451 /**
452 * @see _.flatMap
453 */
454 flatMap<TResult = any>(iteratee: ListIterator<T, Many<TResult>> | PropertyName): Collection<TResult>;
455 /**
456 * @see _.flatMap
457 */
458 flatMap(iteratee: [PropertyName, any] | object): Collection<boolean>;
459 /**
460 * @see _.flatMap
461 */
462 flatMap(): T extends Many<infer U> ? Collection<U> : Collection<T>;
463 }
464 interface Object<T> {
465 /**
466 * @see _.flatMap
467 */
468 flatMap<TResult = any>(iteratee: ObjectIterator<T, Many<TResult>> | PropertyName): Collection<TResult>;
469 /**
470 * @see _.flatMap
471 */
472 flatMap(iteratee: [PropertyName, any] | object): Collection<boolean>;
473 /**
474 * @see _.flatMap
475 */
476 flatMap(): Collection<T[keyof T]>;
477 }
478 interface StringChain {
479 /**
480 * @see _.flatMap
481 */
482 flatMap<TResult>(iteratee: StringIterator<Many<TResult>>): CollectionChain<TResult>;
483 /**
484 * @see _.flatMap
485 */
486 flatMap(): CollectionChain<string>;
487 }
488 interface StringNullableChain {
489 /**
490 * @see _.flatMap
491 */
492 flatMap<TResult>(iteratee: StringIterator<Many<TResult>>): CollectionChain<TResult>;
493 /**
494 * @see _.flatMap
495 */
496 flatMap(): CollectionChain<string>;
497 }
498 interface CollectionChain<T> {
499 /**
500 * @see _.flatMap
501 */
502 flatMap<TResult = any>(iteratee: ListIterator<T, Many<TResult>> | PropertyName): CollectionChain<TResult>;
503 /**
504 * @see _.flatMap
505 */
506 flatMap(iteratee: [PropertyName, any] | object): CollectionChain<boolean>;
507 /**
508 * @see _.flatMap
509 */
510 flatMap(): T extends Many<infer U> ? CollectionChain<U> : CollectionChain<T>;
511 }
512 interface ObjectChain<T> {
513 /**
514 * @see _.flatMap
515 */
516 flatMap<TResult = any>(iteratee: ObjectIterator<T, Many<TResult>> | PropertyName): CollectionChain<TResult>;
517 /**
518 * @see _.flatMap
519 */
520 flatMap(iteratee: [PropertyName, any] | object): CollectionChain<boolean>;
521 /**
522 * @see _.flatMap
523 */
524 flatMap(): CollectionChain<T[keyof T]>;
525 }
526 interface LoDashStatic {
527 /**
528 * This method is like `_.flatMap` except that it recursively flattens the
529 * mapped results.
530 *
531 * @since 4.7.0
532 * @category Collection
533 * @param collection The collection to iterate over.
534 * @param [iteratee=_.identity] The function invoked per iteration.
535 * @returns Returns the new flattened array.
536 * @example
537 *
538 * function duplicate(n) {
539 * return [[[n, n]]];
540 * }
541 *
542 * _.flatMapDeep([1, 2], duplicate);
543 * // => [1, 1, 2, 2]
544 */
545 flatMapDeep<T>(collection: Dictionary<ListOfRecursiveArraysOrValues<T> | T> | NumericDictionary<ListOfRecursiveArraysOrValues<T> | T> | null | undefined): T[];
546 /**
547 * @see _.flatMapDeep
548 */
549 flatMapDeep<T, TResult>(collection: List<T> | null | undefined, iteratee: ListIterator<T, ListOfRecursiveArraysOrValues<TResult> | TResult>): TResult[];
550 /**
551 * @see _.flatMapDeep
552 */
553 flatMapDeep<T extends object, TResult>(collection: T | null | undefined, iteratee: ObjectIterator<T, ListOfRecursiveArraysOrValues<TResult> | TResult>): TResult[];
554 /**
555 * @see _.flatMapDeep
556 */
557 flatMapDeep(collection: object | null | undefined, iteratee: string): any[];
558 /**
559 * @see _.flatMapDeep
560 */
561 flatMapDeep(collection: object | null | undefined, iteratee: object): boolean[];
562 }
563 interface String {
564 /**
565 * @see _.flatMapDeep
566 */
567 flatMapDeep<TResult>(iteratee: StringIterator<ListOfRecursiveArraysOrValues<TResult> | TResult>): Collection<TResult>;
568 /**
569 * @see _.flatMapDeep
570 */
571 flatMapDeep(): Collection<string>;
572 }
573 interface Collection<T> {
574 /**
575 * @see _.flatMapDeep
576 */
577 flatMapDeep<TResult = any>(iteratee: ListIterator<T, ListOfRecursiveArraysOrValues<TResult> | TResult> | PropertyName): Collection<TResult>;
578 /**
579 * @see _.flatMapDeep
580 */
581 flatMapDeep(iteratee: [PropertyName, any] | object): Collection<boolean>;
582 /**
583 * @see _.flatMapDeep
584 */
585 flatMapDeep(): Collection<T>;
586 }
587 interface Object<T> {
588 /**
589 * @see _.flatMapDeep
590 */
591 flatMapDeep<TResult = any>(iteratee: ObjectIterator<T, ListOfRecursiveArraysOrValues<TResult> | TResult> | PropertyName): Collection<TResult>;
592 /**
593 * @see _.flatMapDeep
594 */
595 flatMapDeep(iteratee: [PropertyName, any] | object): Collection<boolean>;
596 /**
597 * @see _.flatMapDeep
598 */
599 flatMapDeep(): Collection<T[keyof T]>;
600 }
601 interface StringChain {
602 /**
603 * @see _.flatMapDeep
604 */
605 flatMapDeep<TResult>(iteratee: StringIterator<ListOfRecursiveArraysOrValues<TResult> | TResult>): CollectionChain<TResult>;
606 /**
607 * @see _.flatMapDeep
608 */
609 flatMapDeep(): CollectionChain<string>;
610 }
611 interface StringNullableChain {
612 /**
613 * @see _.flatMapDeep
614 */
615 flatMapDeep<TResult>(iteratee: StringIterator<ListOfRecursiveArraysOrValues<TResult> | TResult>): CollectionChain<TResult>;
616 /**
617 * @see _.flatMapDeep
618 */
619 flatMapDeep(): CollectionChain<string>;
620 }
621 interface CollectionChain<T> {
622 /**
623 * @see _.flatMapDeep
624 */
625 flatMapDeep<TResult = any>(iteratee: ListIterator<T, ListOfRecursiveArraysOrValues<TResult> | TResult> | PropertyName): CollectionChain<TResult>;
626 /**
627 * @see _.flatMapDeep
628 */
629 flatMapDeep(iteratee: [PropertyName, any] | object): CollectionChain<boolean>;
630 /**
631 * @see _.flatMapDeep
632 */
633 flatMapDeep(): CollectionChain<T>;
634 }
635 interface ObjectChain<T> {
636 /**
637 * @see _.flatMapDeep
638 */
639 flatMapDeep<TResult = any>(iteratee: ObjectIterator<T, ListOfRecursiveArraysOrValues<TResult> | TResult> | PropertyName): CollectionChain<TResult>;
640 /**
641 * @see _.flatMapDeep
642 */
643 flatMapDeep(iteratee: [PropertyName, any] | object): CollectionChain<boolean>;
644 /**
645 * @see _.flatMapDeep
646 */
647 flatMapDeep(): CollectionChain<T[keyof T]>;
648 }
649 interface LoDashStatic {
650 /**
651 * This method is like `_.flatMap` except that it recursively flattens the
652 * mapped results up to `depth` times.
653 *
654 * @since 4.7.0
655 * @category Collection
656 * @param collection The collection to iterate over.
657 * @param [iteratee=_.identity] The function invoked per iteration.
658 * @param [depth=1] The maximum recursion depth.
659 * @returns Returns the new flattened array.
660 * @example
661 *
662 * function duplicate(n) {
663 * return [[[n, n]]];
664 * }
665 *
666 * _.flatMapDepth([1, 2], duplicate, 2);
667 * // => [[1, 1], [2, 2]]
668 */
669 flatMapDepth<T>(collection: Dictionary<ListOfRecursiveArraysOrValues<T> | T> | NumericDictionary<ListOfRecursiveArraysOrValues<T> | T> | null | undefined): T[];
670 /**
671 * @see _.flatMapDepth
672 */
673 flatMapDepth<T, TResult>(collection: List<T> | null | undefined, iteratee: ListIterator<T, ListOfRecursiveArraysOrValues<TResult> | TResult>, depth?: number): TResult[];
674 /**
675 * @see _.flatMapDepth
676 */
677 flatMapDepth<T extends object, TResult>(collection: T | null | undefined, iteratee: ObjectIterator<T, ListOfRecursiveArraysOrValues<TResult> | TResult>, depth?: number): TResult[];
678 /**
679 * @see _.flatMapDepth
680 */
681 flatMapDepth(collection: object | null | undefined, iteratee: string, depth?: number): any[];
682 /**
683 * @see _.flatMapDepth
684 */
685 flatMapDepth(collection: object | null | undefined, iteratee: object, depth?: number): boolean[];
686 }
687 interface String {
688 /**
689 * @see _.flatMapDepth
690 */
691 flatMapDepth<TResult>(iteratee: StringIterator<ListOfRecursiveArraysOrValues<TResult> | TResult>, depth?: number): Collection<TResult>;
692 /**
693 * @see _.flatMapDepth
694 */
695 flatMapDepth(depth?: number): Collection<string>;
696 }
697 interface Collection<T> {
698 /**
699 * @see _.flatMapDepth
700 */
701 flatMapDepth<TResult = any>(iteratee: ListIterator<T, ListOfRecursiveArraysOrValues<TResult> | TResult> | PropertyName, depth?: number): Collection<TResult>;
702 /**
703 * @see _.flatMapDepth
704 */
705 flatMapDepth(iteratee: [PropertyName, any] | object, depth?: number): Collection<boolean>;
706 /**
707 * @see _.flatMapDepth
708 */
709 flatMapDepth(depth?: number): Collection<T>;
710 }
711 interface Object<T> {
712 /**
713 * @see _.flatMapDepth
714 */
715 flatMapDepth<TResult = any>(iteratee: ObjectIterator<T, ListOfRecursiveArraysOrValues<TResult> | TResult> | PropertyName, depth?: number): Collection<TResult>;
716 /**
717 * @see _.flatMapDepth
718 */
719 flatMapDepth(iteratee: [PropertyName, any] | object, depth?: number): Collection<boolean>;
720 /**
721 * @see _.flatMapDepth
722 */
723 flatMapDepth(depth?: number): Collection<T[keyof T]>;
724 }
725 interface StringChain {
726 /**
727 * @see _.flatMapDepth
728 */
729 flatMapDepth<TResult>(iteratee: StringIterator<ListOfRecursiveArraysOrValues<TResult> | TResult>, depth?: number): CollectionChain<TResult>;
730 /**
731 * @see _.flatMapDepth
732 */
733 flatMapDepth(depth?: number): CollectionChain<string>;
734 }
735 interface StringNullableChain {
736 /**
737 * @see _.flatMapDepth
738 */
739 flatMapDepth<TResult>(iteratee: StringIterator<ListOfRecursiveArraysOrValues<TResult> | TResult>, depth?: number): CollectionChain<TResult>;
740 /**
741 * @see _.flatMapDepth
742 */
743 flatMapDepth(depth?: number): CollectionChain<string>;
744 }
745 interface CollectionChain<T> {
746 /**
747 * @see _.flatMapDepth
748 */
749 flatMapDepth<TResult = any>(iteratee: ListIterator<T, ListOfRecursiveArraysOrValues<TResult> | TResult> | PropertyName, depth?: number): CollectionChain<TResult>;
750 /**
751 * @see _.flatMapDepth
752 */
753 flatMapDepth(iteratee: [PropertyName, any] | object, depth?: number): CollectionChain<boolean>;
754 /**
755 * @see _.flatMapDepth
756 */
757 flatMapDepth(depth?: number): CollectionChain<T>;
758 }
759 interface ObjectChain<T> {
760 /**
761 * @see _.flatMapDepth
762 */
763 flatMapDepth<TResult = any>(iteratee: ObjectIterator<T, ListOfRecursiveArraysOrValues<TResult> | TResult> | PropertyName, depth?: number): CollectionChain<TResult>;
764 /**
765 * @see _.flatMapDepth
766 */
767 flatMapDepth(iteratee: [PropertyName, any] | object, depth?: number): CollectionChain<boolean>;
768 /**
769 * @see _.flatMapDepth
770 */
771 flatMapDepth(depth?: number): CollectionChain<T[keyof T]>;
772 }
773 interface LoDashStatic {
774 /**
775 * Iterates over elements of collection invoking iteratee for each element. The iteratee is invoked with three arguments:
776 * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false.
777 *
778 * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To
779 * avoid this behavior _.forIn or _.forOwn may be used for object iteration.
780 *
781 * @alias _.each
782 *
783 * @param collection The collection to iterate over.
784 * @param iteratee The function invoked per iteration.
785 */
786 forEach<T>(collection: T[], iteratee?: ArrayIterator<T, any>): T[];
787 /**
788 * @see _.forEach
789 */
790 forEach(collection: string, iteratee?: StringIterator<any>): string;
791 /**
792 * @see _.forEach
793 */
794 forEach<T>(collection: List<T>, iteratee?: ListIterator<T, any>): List<T>;
795 /**
796 * @see _.forEach
797 */
798 forEach<T extends object>(collection: T, iteratee?: ObjectIterator<T, any>): T;
799 /**
800 * @see _.forEach
801 */
802 forEach<T, TArray extends T[] | null | undefined>(collection: TArray & (T[] | null | undefined), iteratee?: ArrayIterator<T, any>): TArray;
803 /**
804 * @see _.forEach
805 */
806 forEach<TString extends string | null | undefined>(collection: TString, iteratee?: StringIterator<any>): TString;
807 /**
808 * @see _.forEach
809 */
810 forEach<T, TList extends List<T> | null | undefined>(collection: TList & (List<T> | null | undefined), iteratee?: ListIterator<T, any>): TList;
811 /**
812 * @see _.forEach
813 */
814 forEach<T extends object>(collection: T | null | undefined, iteratee?: ObjectIterator<T, any>): T | null | undefined;
815 }
816 interface String {
817 /**
818 * @see _.forEach
819 */
820 forEach(iteratee?: StringIterator<any>): String;
821 }
822 interface Object<T> {
823 /**
824 * @see _.forEach
825 */
826 forEach(iteratee?: ObjectIterator<T, any>): Object<T>;
827 }
828 interface Collection<T> {
829 /**
830 * @see _.forEach
831 */
832 forEach(iteratee?: ListIterator<T, any>): Collection<T>;
833 }
834 interface StringChain {
835 /**
836 * @see _.forEach
837 */
838 forEach(iteratee?: StringIterator<any>): StringChain;
839 }
840 interface StringNullableChain {
841 /**
842 * @see _.forEach
843 */
844 forEach(iteratee?: StringIterator<any>): StringNullableChain;
845 }
846 interface ObjectChain<T> {
847 /**
848 * @see _.forEach
849 */
850 forEach(iteratee?: ObjectIterator<T, any>): ObjectChain<T>;
851 }
852 interface CollectionChain<T> {
853 /**
854 * @see _.forEach
855 */
856 forEach(iteratee?: ListIterator<T, any>): CollectionChain<T>;
857 }
858 interface LoDashStatic {
859 /**
860 * This method is like _.forEach except that it iterates over elements of collection from right to left.
861 *
862 * @alias _.eachRight
863 *
864 * @param collection The collection to iterate over.
865 * @param iteratee The function called per iteration.
866 */
867 forEachRight<T>(collection: T[], iteratee?: ArrayIterator<T, any>): T[];
868 /**
869 * @see _.forEachRight
870 */
871 forEachRight(collection: string, iteratee?: StringIterator<any>): string;
872 /**
873 * @see _.forEachRight
874 */
875 forEachRight<T>(collection: List<T>, iteratee?: ListIterator<T, any>): List<T>;
876 /**
877 * @see _.forEachRight
878 */
879 forEachRight<T extends object>(collection: T, iteratee?: ObjectIterator<T, any>): T;
880 /**
881 * @see _.forEachRight
882 */
883 forEachRight<T, TArray extends T[] | null | undefined>(collection: TArray & (T[] | null | undefined), iteratee?: ArrayIterator<T, any>): TArray;
884 /**
885 * @see _.forEachRight
886 */
887 forEachRight<TString extends string | null | undefined>(collection: TString, iteratee?: StringIterator<any>): TString;
888 /**
889 * @see _.forEachRight
890 */
891 forEachRight<T, TList extends List<T> | null | undefined>(collection: TList & (List<T> | null | undefined), iteratee?: ListIterator<T, any>): TList;
892 /**
893 * @see _.forEachRight
894 */
895 forEachRight<T extends object>(collection: T | null | undefined, iteratee?: ObjectIterator<T, any>): T | null | undefined;
896 }
897 interface String {
898 /**
899 * @see _.forEachRight
900 */
901 forEachRight(iteratee?: StringIterator<any>): String;
902 }
903 interface Object<T> {
904 /**
905 * @see _.forEachRight
906 */
907 forEachRight(iteratee?: ObjectIterator<T, any>): Object<T>;
908 }
909 interface Collection<T> {
910 /**
911 * @see _.forEachRight
912 */
913 forEachRight(iteratee?: ListIterator<T, any>): Collection<T>;
914 }
915 interface StringChain {
916 /**
917 * @see _.forEachRight
918 */
919 forEachRight(iteratee?: StringIterator<any>): StringChain;
920 }
921 interface StringNullableChain {
922 /**
923 * @see _.forEachRight
924 */
925 forEachRight(iteratee?: StringIterator<any>): StringNullableChain;
926 }
927 interface ObjectChain<T> {
928 /**
929 * @see _.forEachRight
930 */
931 forEachRight(iteratee?: ObjectIterator<T, any>): ObjectChain<T>;
932 }
933 interface CollectionChain<T> {
934 /**
935 * @see _.forEachRight
936 */
937 forEachRight(iteratee?: ListIterator<T, any>): CollectionChain<T>;
938 }
939 interface LoDashStatic {
940 /**
941 * Creates an object composed of keys generated from the results of running each element of collection through
942 * iteratee. The corresponding value of each key is an array of the elements responsible for generating the
943 * key. The iteratee is invoked with one argument: (value).
944 *
945 * @param collection The collection to iterate over.
946 * @param iteratee The function invoked per iteration.
947 * @return Returns the composed aggregate object.
948 */
949 groupBy<T>(collection: List<T> | null | undefined, iteratee?: ValueIteratee<T>): Dictionary<T[]>;
950 /**
951 * @see _.groupBy
952 */
953 groupBy<T extends object>(collection: T | null | undefined, iteratee?: ValueIteratee<T[keyof T]>): Dictionary<Array<T[keyof T]>>;
954 }
955 interface String {
956 /**
957 * @see _.groupBy
958 */
959 groupBy(iteratee?: ValueIteratee<string>): Object<Dictionary<string[]>>;
960 }
961 interface Collection<T> {
962 /**
963 * @see _.groupBy
964 */
965 groupBy(iteratee?: ValueIteratee<T>): Object<Dictionary<T[]>>;
966 }
967 interface Object<T> {
968 /**
969 * @see _.groupBy
970 */
971 groupBy(iteratee?: ValueIteratee<T[keyof T]>): Object<Dictionary<Array<T[keyof T]>>>;
972 }
973 interface StringChain {
974 /**
975 * @see _.groupBy
976 */
977 groupBy(iteratee?: ValueIteratee<string>): ObjectChain<Dictionary<string[]>>;
978 }
979 interface StringNullableChain {
980 /**
981 * @see _.groupBy
982 */
983 groupBy(iteratee?: ValueIteratee<string>): ObjectChain<Dictionary<string[]>>;
984 }
985 interface CollectionChain<T> {
986 /**
987 * @see _.groupBy
988 */
989 groupBy(iteratee?: ValueIteratee<T>): ObjectChain<Dictionary<T[]>>;
990 }
991 interface ObjectChain<T> {
992 /**
993 * @see _.groupBy
994 */
995 groupBy(iteratee?: ValueIteratee<T[keyof T]>): ObjectChain<Dictionary<Array<T[keyof T]>>>;
996 }
997 interface LoDashStatic {
998 /**
999 * Checks if target is in collection using SameValueZero for equality comparisons. If fromIndex is negative,
1000 * it’s used as the offset from the end of collection.
1001 *
1002 * @param collection The collection to search.
1003 * @param target The value to search for.
1004 * @param fromIndex The index to search from.
1005 * @return True if the target element is found, else false.
1006 */
1007 includes<T>(collection: Dictionary<T> | NumericDictionary<T> | null | undefined, target: T, fromIndex?: number): boolean;
1008 }
1009 interface Object<T> {
1010 /**
1011 * @see _.includes
1012 */
1013 includes(target: T[keyof T], fromIndex?: number): boolean;
1014 }
1015 interface Collection<T> {
1016 /**
1017 * @see _.includes
1018 */
1019 includes(target: T, fromIndex?: number): boolean;
1020 }
1021 interface String {
1022 /**
1023 * @see _.includes
1024 */
1025 includes(target: string, fromIndex?: number): boolean;
1026 }
1027 interface ObjectChain<T> {
1028 /**
1029 * @see _.includes
1030 */
1031 includes(target: T[keyof T], fromIndex?: number): PrimitiveChain<boolean>;
1032 }
1033 interface CollectionChain<T> {
1034 /**
1035 * @see _.includes
1036 */
1037 includes(target: T, fromIndex?: number): PrimitiveChain<boolean>;
1038 }
1039 interface StringChain {
1040 /**
1041 * @see _.includes
1042 */
1043 includes(target: string, fromIndex?: number): PrimitiveChain<boolean>;
1044 }
1045 interface LoDashStatic {
1046 /**
1047 * Invokes the method named by methodName on each element in the collection returning
1048 * an array of the results of each invoked method. Additional arguments will be provided
1049 * to each invoked method. If methodName is a function it will be invoked for, and this
1050 * bound to, each element in the collection.
1051 * @param collection The collection to iterate over.
1052 * @param methodName The name of the method to invoke.
1053 * @param args Arguments to invoke the method with.
1054 */
1055 invokeMap(collection: object | null | undefined, methodName: string, ...args: any[]): any[];
1056 /**
1057 * @see _.invokeMap
1058 */
1059 invokeMap<TResult>(collection: object | null | undefined, method: (...args: any[]) => TResult, ...args: any[]): TResult[];
1060 }
1061 interface LoDashImplicitWrapper<TValue> {
1062 /**
1063 * @see _.invokeMap
1064 */
1065 invokeMap(methodName: string, ...args: any[]): Collection<any>;
1066 /**
1067 * @see _.invokeMap
1068 */
1069 invokeMap<TResult>(method: (...args: any[]) => TResult, ...args: any[]): Collection<TResult>;
1070 }
1071 interface LoDashExplicitWrapper<TValue> {
1072 /**
1073 * @see _.invokeMap
1074 */
1075 invokeMap(methodName: string, ...args: any[]): CollectionChain<any>;
1076 /**
1077 * @see _.invokeMap
1078 */
1079 invokeMap<TResult>(method: (...args: any[]) => TResult, ...args: any[]): CollectionChain<TResult>;
1080 }
1081 interface LoDashStatic {
1082 /**
1083 * Creates an object composed of keys generated from the results of running each element of collection through
1084 * iteratee. The corresponding value of each key is the last element responsible for generating the key. The
1085 * iteratee function is invoked with one argument: (value).
1086 *
1087 * @param collection The collection to iterate over.
1088 * @param iteratee The function invoked per iteration.
1089 * @return Returns the composed aggregate object.
1090 */
1091 keyBy<T>(collection: List<T> | null | undefined, iteratee?: ValueIterateeCustom<T, PropertyName>): Dictionary<T>;
1092 /**
1093 * @see _.keyBy
1094 */
1095 keyBy<T extends object>(collection: T | null | undefined, iteratee?: ValueIterateeCustom<T[keyof T], PropertyName>): Dictionary<T[keyof T]>;
1096 }
1097 interface String {
1098 /**
1099 * @see _.keyBy
1100 */
1101 keyBy(iteratee?: ValueIterateeCustom<string, PropertyName>): Object<Dictionary<string>>;
1102 }
1103 interface Collection<T> {
1104 /**
1105 * @see _.keyBy
1106 */
1107 keyBy(iteratee?: ValueIterateeCustom<T, PropertyName>): Object<Dictionary<T>>;
1108 }
1109 interface Object<T> {
1110 /**
1111 * @see _.keyBy
1112 */
1113 keyBy(iteratee?: ValueIterateeCustom<T[keyof T], PropertyName>): Object<Dictionary<T[keyof T]>>;
1114 }
1115 interface StringChain {
1116 /**
1117 * @see _.keyBy
1118 */
1119 keyBy(iteratee?: ValueIterateeCustom<string, PropertyName>): ObjectChain<Dictionary<string>>;
1120 }
1121 interface StringNullableChain {
1122 /**
1123 * @see _.keyBy
1124 */
1125 keyBy(iteratee?: ValueIterateeCustom<string, PropertyName>): ObjectChain<Dictionary<string>>;
1126 }
1127 interface CollectionChain<T> {
1128 /**
1129 * @see _.keyBy
1130 */
1131 keyBy(iteratee?: ValueIterateeCustom<T, PropertyName>): ObjectChain<Dictionary<T>>;
1132 }
1133 interface ObjectChain<T> {
1134 /**
1135 * @see _.keyBy
1136 */
1137 keyBy(iteratee?: ValueIterateeCustom<T[keyof T], PropertyName>): ObjectChain<Dictionary<T[keyof T]>>;
1138 }
1139 interface LoDashStatic {
1140 /**
1141 * Creates an array of values by running each element in collection through iteratee. The iteratee is
1142 * invoked with three arguments: (value, index|key, collection).
1143 *
1144 * Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues,
1145 * _.reject, and _.some.
1146 *
1147 * The guarded methods are:
1148 * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max,
1149 * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range,
1150 * sample, some, sum, uniq, and words
1151 *
1152 * @param collection The collection to iterate over.
1153 * @param iteratee The function invoked per iteration.
1154 * @return Returns the new mapped array.
1155 */
1156 map<T extends readonly [unknown, ...unknown[]], TResult>(collection: T, iteratee: TupleIterator<T, TResult>): { [K in keyof T]: TResult };
1157 /**
1158 * @see _.map
1159 */
1160 map<T, TResult>(collection: T[] | null | undefined, iteratee: ArrayIterator<T, TResult>): TResult[];
1161 /**
1162 * @see _.map
1163 */
1164 map<T, TResult>(collection: List<T> | null | undefined, iteratee: ListIterator<T, TResult>): TResult[];
1165 /**
1166 * @see _.map
1167 */
1168 map<T>(collection: Dictionary<T> | NumericDictionary<T> | null | undefined): T[];
1169 /**
1170 * @see _.map
1171 */
1172 map<T extends object, TResult>(collection: T | null | undefined, iteratee: ObjectIterator<T, TResult>): TResult[];
1173 /**
1174 * @see _.map
1175 */
1176 map<T, K extends keyof T>(collection: Dictionary<T> | NumericDictionary<T> | null | undefined, iteratee: K): Array<T[K]>;
1177 /**
1178 * @see _.map
1179 */
1180 map<T>(collection: Dictionary<T> | NumericDictionary<T> | null | undefined, iteratee?: string): any[];
1181 /**
1182 * @see _.map
1183 */
1184 map<T>(collection: Dictionary<T> | NumericDictionary<T> | null | undefined, iteratee?: object): boolean[];
1185 }
1186
1187 interface String {
1188 /**
1189 * @see _.map
1190 */
1191 map<TResult>(iteratee: StringIterator<TResult>): Collection<TResult>;
1192 /**
1193 * @see _.map
1194 */
1195 map(): Collection<string>;
1196 }
1197 interface Collection<T> {
1198 /**
1199 * @see _.map
1200 */
1201 map<K extends keyof T>(key: K): Collection<T[K]>;
1202 /**
1203 * @see _.map
1204 */
1205 map<TResult>(iteratee: ListIterator<T, TResult>): Collection<TResult>;
1206 /**
1207 * @see _.map
1208 */
1209 map(iteratee: PropertyName): Collection<any>;
1210 /**
1211 * @see _.map
1212 */
1213 map(iteratee: [PropertyName, any] | object): Collection<boolean>;
1214 /**
1215 * @see _.map
1216 */
1217 map(): Collection<T>;
1218 }
1219 interface Object<T> {
1220 /**
1221 * @see _.map
1222 */
1223 map<K extends keyof T[keyof T]>(key: K): Collection<T[keyof T][K]>;
1224 /**
1225 * @see _.map
1226 */
1227 map<TResult>(iteratee: ObjectIterator<T, TResult>): Collection<TResult>;
1228 /**
1229 * @see _.map
1230 */
1231 map(iteratee: PropertyName): Collection<any>;
1232 /**
1233 * @see _.map
1234 */
1235 map(iteratee: [PropertyName, any] | object): Collection<boolean>;
1236 /**
1237 * @see _.map
1238 */
1239 map(): Collection<T[keyof T]>;
1240 }
1241 interface StringChain {
1242 /**
1243 * @see _.map
1244 */
1245 map<TResult>(iteratee: StringIterator<TResult>): CollectionChain<TResult>;
1246 /**
1247 * @see _.map
1248 */
1249 map(): CollectionChain<string>;
1250 }
1251 interface StringNullableChain {
1252 /**
1253 * @see _.map
1254 */
1255 map<TResult>(iteratee: StringIterator<TResult>): CollectionChain<TResult>;
1256 /**
1257 * @see _.map
1258 */
1259 map(): CollectionChain<string>;
1260 }
1261 interface CollectionChain<T> {
1262 /**
1263 * @see _.map
1264 */
1265 map<K extends keyof T>(key: K): CollectionChain<T[K]>;
1266 /**
1267 * @see _.map
1268 */
1269 map<TResult>(iteratee: ListIterator<T, TResult>): CollectionChain<TResult>;
1270 /**
1271 * @see _.map
1272 */
1273 map(iteratee: PropertyName): CollectionChain<any>;
1274 /**
1275 * @see _.map
1276 */
1277 map(iteratee: [PropertyName, any] | object): CollectionChain<boolean>;
1278 /**
1279 * @see _.map
1280 */
1281 map(): CollectionChain<T>;
1282 }
1283 interface ObjectChain<T> {
1284 /**
1285 * @see _.map
1286 */
1287 map<K extends keyof T[keyof T]>(key: K): CollectionChain<T[keyof T][K]>;
1288 /**
1289 * @see _.map
1290 */
1291 map<TResult>(iteratee: ObjectIterator<T, TResult>): CollectionChain<TResult>;
1292 /**
1293 * @see _.map
1294 */
1295 map(iteratee: PropertyName): CollectionChain<any>;
1296 /**
1297 * @see _.map
1298 */
1299 map(iteratee: [PropertyName, any] | object): CollectionChain<boolean>;
1300 /**
1301 * @see _.map
1302 */
1303 map(): CollectionChain<T[keyof T]>;
1304 }
1305 interface LoDashStatic {
1306 /**
1307 * This method is like `_.sortBy` except that it allows specifying the sort
1308 * orders of the iteratees to sort by. If `orders` is unspecified, all values
1309 * are sorted in ascending order. Otherwise, specify an order of "desc" for
1310 * descending or "asc" for ascending sort order of corresponding values.
1311 *
1312 * @category Collection
1313 * @param collection The collection to iterate over.
1314 * @param [iteratees=[_.identity]] The iteratees to sort by.
1315 * @param [orders] The sort orders of `iteratees`.
1316 * @param [guard] Enables use as an iteratee for functions like `_.reduce`.
1317 * @returns Returns the new sorted array.
1318 * @example
1319 *
1320 * var users = [
1321 * { 'user': 'fred', 'age': 48 },
1322 * { 'user': 'barney', 'age': 34 },
1323 * { 'user': 'fred', 'age': 42 },
1324 * { 'user': 'barney', 'age': 36 }
1325 * ];
1326 *
1327 * // sort by `user` in ascending order and by `age` in descending order
1328 * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
1329 * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
1330 */
1331 orderBy<T>(collection: List<T> | null | undefined, iteratees?: Many<ListIterator<T, NotVoid>>, orders?: Many<boolean|"asc"|"desc">): T[];
1332 /**
1333 * @see _.orderBy
1334 */
1335 orderBy<T>(collection: List<T> | null | undefined, iteratees?: Many<ListIteratee<T>>, orders?: Many<boolean|"asc"|"desc">): T[];
1336 /**
1337 * @see _.orderBy
1338 */
1339 orderBy<T extends object>(collection: T | null | undefined, iteratees?: Many<ObjectIterator<T, NotVoid>>, orders?: Many<boolean|"asc"|"desc">): Array<T[keyof T]>;
1340 /**
1341 * @see _.orderBy
1342 */
1343 orderBy<T extends object>(collection: T | null | undefined, iteratees?: Many<ObjectIteratee<T>>, orders?: Many<boolean|"asc"|"desc">): Array<T[keyof T]>;
1344 }
1345 interface Collection<T> {
1346 /**
1347 * @see _.orderBy
1348 */
1349 orderBy(iteratees?: Many<ListIterator<T, NotVoid> | PropertyName | PartialShallow<T>>, orders?: Many<boolean|"asc"|"desc">): Collection<T>;
1350 }
1351 interface Object<T> {
1352 /**
1353 * @see _.orderBy
1354 */
1355 orderBy(iteratees?: Many<ObjectIterator<T, NotVoid>>, orders?: Many<boolean|"asc"|"desc">): Collection<T[keyof T]>;
1356 }
1357 interface CollectionChain<T> {
1358 /**
1359 * @see _.orderBy
1360 */
1361 orderBy(iteratees?: Many<ListIterator<T, NotVoid> | PropertyName | PartialShallow<T>>, orders?: Many<boolean|"asc"|"desc">): CollectionChain<T>;
1362 }
1363 interface ObjectChain<T> {
1364 /**
1365 * @see _.orderBy
1366 */
1367 orderBy(iteratees?: Many<ObjectIterator<T, NotVoid>>, orders?: Many<boolean|"asc"|"desc">): CollectionChain<T[keyof T]>;
1368 }
1369 interface LoDashStatic {
1370 /**
1371 * Creates an array of elements split into two groups, the first of which contains elements predicate returns truthy for,
1372 * while the second of which contains elements predicate returns falsey for.
1373 * The predicate is invoked with three arguments: (value, index|key, collection).
1374 *
1375 * @param collection The collection to iterate over.
1376 * @param callback The function called per iteration.
1377 * @return Returns the array of grouped elements.
1378 */
1379 partition<T, U extends T>(collection: List<T> | null | undefined, callback: ValueIteratorTypeGuard<T, U>): [U[], Array<Exclude<T, U>>];
1380 /**
1381 * @see _.partition
1382 */
1383 partition<T>(collection: List<T> | null | undefined, callback: ValueIteratee<T>): [T[], T[]];
1384 /**
1385 * @see _.partition
1386 */
1387 partition<T extends object>(collection: T | null | undefined, callback: ValueIteratee<T[keyof T]>): [Array<T[keyof T]>, Array<T[keyof T]>];
1388 }
1389 interface String {
1390 /**
1391 * @see _.partition
1392 */
1393 partition(callback: StringIterator<NotVoid>): LoDashImplicitWrapper<[string[], string[]]>;
1394 }
1395 interface Collection<T> {
1396 /**
1397 * @see _.partition
1398 */
1399 partition<U extends T>(callback: ValueIteratorTypeGuard<T, U>): LoDashImplicitWrapper<[U[], Array<Exclude<T, U>>]>;
1400 /**
1401 * @see _.partition
1402 */
1403 partition(callback: ValueIteratee<T>): LoDashImplicitWrapper<[T[], T[]]>;
1404 }
1405 interface Object<T> {
1406 /**
1407 * @see _.partition
1408 */
1409 partition(callback: ValueIteratee<T[keyof T]>): LoDashImplicitWrapper<[Array<T[keyof T]>, Array<T[keyof T]>]>;
1410 }
1411 interface StringChain {
1412 /**
1413 * @see _.partition
1414 */
1415 partition(callback: StringIterator<NotVoid>): LoDashExplicitWrapper<[string[], string[]]>;
1416 }
1417 interface StringNullableChain {
1418 /**
1419 * @see _.partition
1420 */
1421 partition(callback: StringIterator<NotVoid>): LoDashExplicitWrapper<[string[], string[]]>;
1422 }
1423 interface CollectionChain<T> {
1424 /**
1425 * @see _.partition
1426 */
1427 partition<U extends T>(callback: ValueIteratorTypeGuard<T, U>): LoDashExplicitWrapper<[U[], Array<Exclude<T, U>>]>;
1428 /**
1429 * @see _.partition
1430 */
1431 partition(callback: ValueIteratee<T>): LoDashExplicitWrapper<[T[], T[]]>;
1432 }
1433 interface ObjectChain<T> {
1434 /**
1435 * @see _.partition
1436 */
1437 partition(callback: ValueIteratee<T[keyof T]>): LoDashExplicitWrapper<[Array<T[keyof T]>, Array<T[keyof T]>]>;
1438 }
1439 interface LoDashStatic {
1440 /**
1441 * Reduces a collection to a value which is the accumulated result of running each
1442 * element in the collection through the callback, where each successive callback execution
1443 * consumes the return value of the previous execution. If accumulator is not provided the
1444 * first element of the collection will be used as the initial accumulator value. The callback
1445 * is invoked with four arguments: (accumulator, value, index|key, collection).
1446 * @param collection The collection to iterate over.
1447 * @param callback The function called per iteration.
1448 * @param accumulator Initial value of the accumulator.
1449 * @return Returns the accumulated value.
1450 */
1451 reduce<T, TResult>(collection: T[] | null | undefined, callback: MemoListIterator<T, TResult, T[]>, accumulator: TResult): TResult;
1452 /**
1453 * @see _.reduce
1454 */
1455 reduce<T, TResult>(collection: List<T> | null | undefined, callback: MemoListIterator<T, TResult, List<T>>, accumulator: TResult): TResult;
1456 /**
1457 * @see _.reduce
1458 */
1459 reduce<T extends object, TResult>(collection: T | null | undefined, callback: MemoObjectIterator<T[keyof T], TResult, T>, accumulator: TResult): TResult;
1460 /**
1461 * @see _.reduce
1462 */
1463 reduce<T>(collection: T[] | null | undefined, callback: MemoListIterator<T, T, T[]>): T | undefined;
1464 /**
1465 * @see _.reduce
1466 */
1467 reduce<T>(collection: List<T> | null | undefined, callback: MemoListIterator<T, T, List<T>>): T | undefined;
1468 /**
1469 * @see _.reduce
1470 */
1471 reduce<T extends object>(collection: T | null | undefined, callback: MemoObjectIterator<T[keyof T], T[keyof T], T>): T[keyof T] | undefined;
1472 }
1473 interface Collection<T> {
1474 /**
1475 * @see _.reduce
1476 */
1477 reduce<TResult>(callback: MemoListIterator<T, TResult, List<T>>, accumulator: TResult): TResult;
1478 /**
1479 * @see _.reduce
1480 */
1481 reduce(callback: MemoListIterator<T, T, List<T>>): T | undefined;
1482 }
1483 interface Object<T> {
1484 /**
1485 * @see _.reduce
1486 */
1487 reduce<TResult>(callback: MemoObjectIterator<T[keyof T], TResult, T>, accumulator: TResult): TResult;
1488 /**
1489 * @see _.reduce
1490 */
1491 reduce(callback: MemoObjectIterator<T[keyof T], T[keyof T], T>): T[keyof T] | undefined;
1492 }
1493 interface CollectionChain<T> {
1494 /**
1495 * @see _.reduce
1496 */
1497 reduce<TResult>(callback: MemoListIterator<T, TResult, List<T>>, accumulator: TResult): ExpChain<TResult>;
1498 /**
1499 * @see _.reduce
1500 */
1501 reduce(callback: MemoListIterator<T, T, List<T>>): ExpChain<T | undefined>;
1502 }
1503 interface ObjectChain<T> {
1504 /**
1505 * @see _.reduce
1506 */
1507 reduce<TResult>(callback: MemoObjectIterator<T[keyof T], TResult, T>, accumulator: TResult): ExpChain<TResult>;
1508 /**
1509 * @see _.reduce
1510 */
1511 reduce(callback: MemoObjectIterator<T[keyof T], T[keyof T], T>): ExpChain<T[keyof T] | undefined>;
1512 }
1513 interface LoDashStatic {
1514 /**
1515 * This method is like _.reduce except that it iterates over elements of a collection from
1516 * right to left.
1517 * @param collection The collection to iterate over.
1518 * @param callback The function called per iteration.
1519 * @param accumulator Initial value of the accumulator.
1520 * @return The accumulated value.
1521 */
1522 reduceRight<T, TResult>(collection: T[] | null | undefined, callback: MemoListIterator<T, TResult, T[]>, accumulator: TResult): TResult;
1523 /**
1524 * @see _.reduceRight
1525 */
1526 reduceRight<T, TResult>(collection: List<T> | null | undefined, callback: MemoListIterator<T, TResult, List<T>>, accumulator: TResult): TResult;
1527 /**
1528 * @see _.reduceRight
1529 */
1530 reduceRight<T extends object, TResult>(collection: T | null | undefined, callback: MemoObjectIterator<T[keyof T], TResult, T>, accumulator: TResult): TResult;
1531 /**
1532 * @see _.reduceRight
1533 */
1534 reduceRight<T>(collection: T[] | null | undefined, callback: MemoListIterator<T, T, T[]>): T | undefined;
1535 /**
1536 * @see _.reduceRight
1537 */
1538 reduceRight<T>(collection: List<T> | null | undefined, callback: MemoListIterator<T, T, List<T>>): T | undefined;
1539 /**
1540 * @see _.reduceRight
1541 */
1542 reduceRight<T extends object>(collection: T | null | undefined, callback: MemoObjectIterator<T[keyof T], T[keyof T], T>): T[keyof T] | undefined;
1543 }
1544 interface Collection<T> {
1545 /**
1546 * @see _.reduceRight
1547 */
1548 reduceRight<TResult>(callback: MemoListIterator<T, TResult, List<T>>, accumulator: TResult): TResult;
1549 /**
1550 * @see _.reduceRight
1551 */
1552 reduceRight(callback: MemoListIterator<T, T, List<T>>): T | undefined;
1553 }
1554 interface Object<T> {
1555 /**
1556 * @see _.reduceRight
1557 */
1558 reduceRight<TResult>(callback: MemoObjectIterator<T[keyof T], TResult, T>, accumulator: TResult): TResult;
1559 /**
1560 * @see _.reduceRight
1561 */
1562 reduceRight(callback: MemoObjectIterator<T[keyof T], T[keyof T], T>): T[keyof T] | undefined;
1563 }
1564 interface CollectionChain<T> {
1565 /**
1566 * @see _.reduceRight
1567 */
1568 reduceRight<TResult>(callback: MemoListIterator<T, TResult, List<T>>, accumulator: TResult): ExpChain<TResult>;
1569 /**
1570 * @see _.reduceRight
1571 */
1572 reduceRight(callback: MemoListIterator<T, T, List<T>>): ExpChain<T | undefined>;
1573 }
1574 interface ObjectChain<T> {
1575 /**
1576 * @see _.reduceRight
1577 */
1578 reduceRight<TResult>(callback: MemoObjectIterator<T[keyof T], TResult, T>, accumulator: TResult): ExpChain<TResult>;
1579 /**
1580 * @see _.reduceRight
1581 */
1582 reduceRight(callback: MemoObjectIterator<T[keyof T], T[keyof T], T>): ExpChain<T[keyof T] | undefined>;
1583 }
1584 interface LoDashStatic {
1585 /**
1586 * The opposite of _.filter; this method returns the elements of collection that predicate does not return
1587 * truthy for.
1588 *
1589 * @param collection The collection to iterate over.
1590 * @param predicate The function invoked per iteration.
1591 * @return Returns the new filtered array.
1592 */
1593 reject(collection: string | null | undefined, predicate?: StringIterator<boolean>): string[];
1594 /**
1595 * @see _.reject
1596 */
1597 reject<T>(collection: List<T> | null | undefined, predicate?: ListIterateeCustom<T, boolean>): T[];
1598 /**
1599 * @see _.reject
1600 */
1601 reject<T extends object>(collection: T | null | undefined, predicate?: ObjectIterateeCustom<T, boolean>): Array<T[keyof T]>;
1602 }
1603 interface String {
1604 /**
1605 * @see _.reject
1606 */
1607 reject(predicate?: StringIterator<boolean>): Collection<string>;
1608 }
1609 interface Collection<T> {
1610 /**
1611 * @see _.reject
1612 */
1613 reject(predicate?: ListIterateeCustom<T, boolean>): Collection<T>;
1614 }
1615 interface Object<T> {
1616 /**
1617 * @see _.reject
1618 */
1619 reject(predicate?: ObjectIterateeCustom<T, boolean>): Collection<T[keyof T]>;
1620 }
1621 interface StringChain {
1622 /**
1623 * @see _.reject
1624 */
1625 reject(predicate?: StringIterator<boolean>): CollectionChain<string>;
1626 }
1627 interface StringNullableChain {
1628 /**
1629 * @see _.reject
1630 */
1631 reject(predicate?: StringIterator<boolean>): CollectionChain<string>;
1632 }
1633 interface CollectionChain<T> {
1634 /**
1635 * @see _.reject
1636 */
1637 reject(predicate?: ListIterateeCustom<T, boolean>): CollectionChain<T>;
1638 }
1639 interface ObjectChain<T> {
1640 /**
1641 * @see _.reject
1642 */
1643 reject(predicate?: ObjectIterateeCustom<T, boolean>): CollectionChain<T[keyof T]>;
1644 }
1645 interface LoDashStatic {
1646 /**
1647 * Gets a random element from collection.
1648 *
1649 * @param collection The collection to sample.
1650 * @return Returns the random element.
1651 */
1652 sample<T>(collection: readonly [T, ...T[]]): T;
1653 /**
1654 * @see _.sample
1655 */
1656 sample<T>(collection: Dictionary<T> | NumericDictionary<T> | null | undefined): T | undefined;
1657 /**
1658 * @see _.sample
1659 */
1660 sample<T extends object>(collection: T | null | undefined): T[keyof T] | undefined;
1661 }
1662 interface String {
1663 /**
1664 * @see _.sample
1665 */
1666 sample(): string | undefined;
1667 }
1668 interface Collection<T> {
1669 /**
1670 * @see _.sample
1671 */
1672 sample(): T | undefined;
1673 }
1674 interface Object<T> {
1675 /**
1676 * @see _.sample
1677 */
1678 sample(): T[keyof T] | undefined;
1679 }
1680 interface StringChain {
1681 /**
1682 * @see _.sample
1683 */
1684 sample(): StringNullableChain;
1685 }
1686 interface StringNullableChain {
1687 /**
1688 * @see _.sample
1689 */
1690 sample(): StringNullableChain;
1691 }
1692 interface CollectionChain<T> {
1693 /**
1694 * @see _.sample
1695 */
1696 sample(): ExpChain<T | undefined>;
1697 }
1698 interface ObjectChain<T> {
1699 /**
1700 * @see _.sample
1701 */
1702 sample(): ExpChain<T[keyof T] | undefined>;
1703 }
1704 interface LoDashStatic {
1705 /**
1706 * Gets n random elements at unique keys from collection up to the size of collection.
1707 *
1708 * @param collection The collection to sample.
1709 * @param n The number of elements to sample.
1710 * @return Returns the random elements.
1711 */
1712 sampleSize<T>(collection: Dictionary<T> | NumericDictionary<T> | null | undefined, n?: number): T[];
1713 /**
1714 * @see _.sampleSize
1715 */
1716 sampleSize<T extends object>(collection: T | null | undefined, n?: number): Array<T[keyof T]>;
1717 }
1718 interface String {
1719 /**
1720 * @see _.sampleSize
1721 */
1722 sampleSize(n?: number): Collection<string>;
1723 }
1724 interface Collection<T> {
1725 /**
1726 * @see _.sampleSize
1727 */
1728 sampleSize(n?: number): Collection<T>;
1729 }
1730 interface Object<T> {
1731 /**
1732 * @see _.sampleSize
1733 */
1734 sampleSize(n?: number): Collection<T[keyof T]>;
1735 }
1736 interface StringChain {
1737 /**
1738 * @see _.sampleSize
1739 */
1740 sampleSize(n?: number): CollectionChain<string>;
1741 }
1742 interface StringNullableChain {
1743 /**
1744 * @see _.sampleSize
1745 */
1746 sampleSize(n?: number): CollectionChain<string>;
1747 }
1748 interface CollectionChain<T> {
1749 /**
1750 * @see _.sampleSize
1751 */
1752 sampleSize(n?: number): CollectionChain<T>;
1753 }
1754 interface ObjectChain<T> {
1755 /**
1756 * @see _.sampleSize
1757 */
1758 sampleSize(n?: number): CollectionChain<T[keyof T]>;
1759 }
1760 interface LoDashStatic {
1761 /**
1762 * Creates an array of shuffled values, using a version of the Fisher-Yates shuffle.
1763 *
1764 * @param collection The collection to shuffle.
1765 * @return Returns the new shuffled array.
1766 */
1767 shuffle<T>(collection: List<T> | null | undefined): T[];
1768 /**
1769 * @see _.shuffle
1770 */
1771 shuffle<T extends object>(collection: T | null | undefined): Array<T[keyof T]>;
1772 }
1773 interface String {
1774 /**
1775 * @see _.shuffle
1776 */
1777 shuffle(): Collection<string>;
1778 }
1779 interface Collection<T> {
1780 /**
1781 * @see _.shuffle
1782 */
1783 shuffle(): Collection<T>;
1784 }
1785 interface Object<T> {
1786 /**
1787 * @see _.shuffle
1788 */
1789 shuffle(): Collection<T[keyof T]>;
1790 }
1791 interface StringChain {
1792 /**
1793 * @see _.shuffle
1794 */
1795 shuffle(): CollectionChain<string>;
1796 }
1797 interface StringNullableChain {
1798 /**
1799 * @see _.shuffle
1800 */
1801 shuffle(): CollectionChain<string>;
1802 }
1803 interface CollectionChain<T> {
1804 /**
1805 * @see _.shuffle
1806 */
1807 shuffle(): CollectionChain<T>;
1808 }
1809 interface ObjectChain<T> {
1810 /**
1811 * @see _.shuffle
1812 */
1813 shuffle(): CollectionChain<T[keyof T]>;
1814 }
1815 interface LoDashStatic {
1816 /**
1817 * Gets the size of collection by returning its length for array-like values or the number of own enumerable
1818 * properties for objects.
1819 *
1820 * @param collection The collection to inspect.
1821 * @return Returns the size of collection.
1822 */
1823 size(collection: object | string | null | undefined): number;
1824 }
1825 interface LoDashImplicitWrapper<TValue> {
1826 /**
1827 * @see _.size
1828 */
1829 size(): number;
1830 }
1831 interface LoDashExplicitWrapper<TValue> {
1832 /**
1833 * @see _.size
1834 */
1835 size(): PrimitiveChain<number>;
1836 }
1837 interface LoDashStatic {
1838 /**
1839 * Checks if predicate returns truthy for any element of collection. Iteration is stopped once predicate
1840 * returns truthy. The predicate is invoked with three arguments: (value, index|key, collection).
1841 *
1842 * @param collection The collection to iterate over.
1843 * @param predicate The function invoked per iteration.
1844 * @return Returns true if any element passes the predicate check, else false.
1845 */
1846 some<T>(collection: List<T> | null | undefined, predicate?: ListIterateeCustom<T, boolean>): boolean;
1847 /**
1848 * @see _.some
1849 */
1850 some<T extends object>(collection: T | null | undefined, predicate?: ObjectIterateeCustom<T, boolean>): boolean;
1851 }
1852 interface Collection<T> {
1853 /**
1854 * @see _.some
1855 */
1856 some(predicate?: ListIterateeCustom<T, boolean>): boolean;
1857 }
1858 interface Object<T> {
1859 /**
1860 * @see _.some
1861 */
1862 some(predicate?: ObjectIterateeCustom<T, boolean>): boolean;
1863 }
1864 interface CollectionChain<T> {
1865 /**
1866 * @see _.some
1867 */
1868 some(predicate?: ListIterateeCustom<T, boolean>): PrimitiveChain<boolean>;
1869 }
1870 interface ObjectChain<T> {
1871 /**
1872 * @see _.some
1873 */
1874 some(predicate?: ObjectIterateeCustom<T, boolean>): PrimitiveChain<boolean>;
1875 }
1876 interface LoDashStatic {
1877 /**
1878 * Creates an array of elements, sorted in ascending order by the results of
1879 * running each element in a collection through each iteratee. This method
1880 * performs a stable sort, that is, it preserves the original sort order of
1881 * equal elements. The iteratees are invoked with one argument: (value).
1882 *
1883 * @category Collection
1884 * @param collection The collection to iterate over.
1885 * @param [iteratees=[_.identity]]
1886 * The iteratees to sort by, specified individually or in arrays.
1887 * @returns Returns the new sorted array.
1888 * @example
1889 *
1890 * var users = [
1891 * { 'user': 'fred', 'age': 48 },
1892 * { 'user': 'barney', 'age': 36 },
1893 * { 'user': 'fred', 'age': 42 },
1894 * { 'user': 'barney', 'age': 34 }
1895 * ];
1896 *
1897 * _.sortBy(users, function(o) { return o.user; });
1898 * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
1899 *
1900 * _.sortBy(users, ['user', 'age']);
1901 * // => objects for [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]]
1902 *
1903 * _.sortBy(users, 'user', function(o) {
1904 * return Math.floor(o.age / 10);
1905 * });
1906 * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
1907 */
1908 sortBy<T>(collection: List<T> | null | undefined, ...iteratees: Array<Many<ListIteratee<T>>>): T[];
1909 /**
1910 * @see _.sortBy
1911 */
1912 sortBy<T extends object>(collection: T | null | undefined, ...iteratees: Array<Many<ObjectIteratee<T>>>): Array<T[keyof T]>;
1913 }
1914 interface Collection<T> {
1915 /**
1916 * @see _.sortBy
1917 */
1918 sortBy(...iteratees: Array<Many<ListIteratee<T>>>): Collection<T>;
1919 }
1920 interface Object<T> {
1921 /**
1922 * @see _.sortBy
1923 */
1924 sortBy(...iteratees: Array<Many<ObjectIteratee<T>>>): Collection<T[keyof T]>;
1925 }
1926 interface CollectionChain<T> {
1927 /**
1928 * @see _.sortBy
1929 */
1930 sortBy(...iteratees: Array<Many<ListIteratee<T>>>): CollectionChain<T>;
1931 }
1932 interface ObjectChain<T> {
1933 /**
1934 * @see _.sortBy
1935 */
1936 sortBy(...iteratees: Array<Many<ObjectIteratee<T>>>): CollectionChain<T[keyof T]>;
1937 }
1938}