UNPKG

67.6 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, TResult>(collection: T[] | null | undefined, iteratee: ArrayIterator<T, TResult>): TResult[];
1157 /**
1158 * @see _.map
1159 */
1160 map<T, TResult>(collection: List<T> | null | undefined, iteratee: ListIterator<T, TResult>): TResult[];
1161 /**
1162 * @see _.map
1163 */
1164 map<T>(collection: Dictionary<T> | NumericDictionary<T> | null | undefined): T[];
1165 /**
1166 * @see _.map
1167 */
1168 map<T extends object, TResult>(collection: T | null | undefined, iteratee: ObjectIterator<T, TResult>): TResult[];
1169 /**
1170 * @see _.map
1171 */
1172 map<T, K extends keyof T>(collection: Dictionary<T> | NumericDictionary<T> | null | undefined, iteratee: K): Array<T[K]>;
1173 /**
1174 * @see _.map
1175 */
1176 map<T>(collection: Dictionary<T> | NumericDictionary<T> | null | undefined, iteratee?: string): any[];
1177 /**
1178 * @see _.map
1179 */
1180 map<T>(collection: Dictionary<T> | NumericDictionary<T> | null | undefined, iteratee?: object): boolean[];
1181 }
1182
1183 interface String {
1184 /**
1185 * @see _.map
1186 */
1187 map<TResult>(iteratee: StringIterator<TResult>): Collection<TResult>;
1188 /**
1189 * @see _.map
1190 */
1191 map(): Collection<string>;
1192 }
1193 interface Collection<T> {
1194 /**
1195 * @see _.map
1196 */
1197 map<K extends keyof T>(key: K): Collection<T[K]>;
1198 /**
1199 * @see _.map
1200 */
1201 map<TResult>(iteratee: ListIterator<T, TResult>): Collection<TResult>;
1202 /**
1203 * @see _.map
1204 */
1205 map(iteratee: PropertyName): Collection<any>;
1206 /**
1207 * @see _.map
1208 */
1209 map(iteratee: [PropertyName, any] | object): Collection<boolean>;
1210 /**
1211 * @see _.map
1212 */
1213 map(): Collection<T>;
1214 }
1215 interface Object<T> {
1216 /**
1217 * @see _.map
1218 */
1219 map<K extends keyof T[keyof T]>(key: K): Collection<T[keyof T][K]>;
1220 /**
1221 * @see _.map
1222 */
1223 map<TResult>(iteratee: ObjectIterator<T, TResult>): Collection<TResult>;
1224 /**
1225 * @see _.map
1226 */
1227 map(iteratee: PropertyName): Collection<any>;
1228 /**
1229 * @see _.map
1230 */
1231 map(iteratee: [PropertyName, any] | object): Collection<boolean>;
1232 /**
1233 * @see _.map
1234 */
1235 map(): Collection<T[keyof T]>;
1236 }
1237 interface StringChain {
1238 /**
1239 * @see _.map
1240 */
1241 map<TResult>(iteratee: StringIterator<TResult>): CollectionChain<TResult>;
1242 /**
1243 * @see _.map
1244 */
1245 map(): CollectionChain<string>;
1246 }
1247 interface StringNullableChain {
1248 /**
1249 * @see _.map
1250 */
1251 map<TResult>(iteratee: StringIterator<TResult>): CollectionChain<TResult>;
1252 /**
1253 * @see _.map
1254 */
1255 map(): CollectionChain<string>;
1256 }
1257 interface CollectionChain<T> {
1258 /**
1259 * @see _.map
1260 */
1261 map<K extends keyof T>(key: K): CollectionChain<T[K]>;
1262 /**
1263 * @see _.map
1264 */
1265 map<TResult>(iteratee: ListIterator<T, TResult>): CollectionChain<TResult>;
1266 /**
1267 * @see _.map
1268 */
1269 map(iteratee: PropertyName): CollectionChain<any>;
1270 /**
1271 * @see _.map
1272 */
1273 map(iteratee: [PropertyName, any] | object): CollectionChain<boolean>;
1274 /**
1275 * @see _.map
1276 */
1277 map(): CollectionChain<T>;
1278 }
1279 interface ObjectChain<T> {
1280 /**
1281 * @see _.map
1282 */
1283 map<K extends keyof T[keyof T]>(key: K): CollectionChain<T[keyof T][K]>;
1284 /**
1285 * @see _.map
1286 */
1287 map<TResult>(iteratee: ObjectIterator<T, TResult>): CollectionChain<TResult>;
1288 /**
1289 * @see _.map
1290 */
1291 map(iteratee: PropertyName): CollectionChain<any>;
1292 /**
1293 * @see _.map
1294 */
1295 map(iteratee: [PropertyName, any] | object): CollectionChain<boolean>;
1296 /**
1297 * @see _.map
1298 */
1299 map(): CollectionChain<T[keyof T]>;
1300 }
1301 interface LoDashStatic {
1302 /**
1303 * This method is like `_.sortBy` except that it allows specifying the sort
1304 * orders of the iteratees to sort by. If `orders` is unspecified, all values
1305 * are sorted in ascending order. Otherwise, specify an order of "desc" for
1306 * descending or "asc" for ascending sort order of corresponding values.
1307 *
1308 * @category Collection
1309 * @param collection The collection to iterate over.
1310 * @param [iteratees=[_.identity]] The iteratees to sort by.
1311 * @param [orders] The sort orders of `iteratees`.
1312 * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`.
1313 * @returns Returns the new sorted array.
1314 * @example
1315 *
1316 * var users = [
1317 * { 'user': 'fred', 'age': 48 },
1318 * { 'user': 'barney', 'age': 34 },
1319 * { 'user': 'fred', 'age': 42 },
1320 * { 'user': 'barney', 'age': 36 }
1321 * ];
1322 *
1323 * // sort by `user` in ascending order and by `age` in descending order
1324 * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
1325 * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
1326 */
1327 orderBy<T>(collection: List<T> | null | undefined, iteratees?: Many<ListIterator<T, NotVoid>>, orders?: Many<boolean|"asc"|"desc">): T[];
1328 /**
1329 * @see _.orderBy
1330 */
1331 orderBy<T>(collection: List<T> | null | undefined, iteratees?: Many<ListIteratee<T>>, orders?: Many<boolean|"asc"|"desc">): T[];
1332 /**
1333 * @see _.orderBy
1334 */
1335 orderBy<T extends object>(collection: T | null | undefined, iteratees?: Many<ObjectIterator<T, NotVoid>>, orders?: Many<boolean|"asc"|"desc">): Array<T[keyof T]>;
1336 /**
1337 * @see _.orderBy
1338 */
1339 orderBy<T extends object>(collection: T | null | undefined, iteratees?: Many<ObjectIteratee<T>>, orders?: Many<boolean|"asc"|"desc">): Array<T[keyof T]>;
1340 }
1341 interface Collection<T> {
1342 /**
1343 * @see _.orderBy
1344 */
1345 orderBy(iteratees?: Many<ListIterator<T, NotVoid> | PropertyName | PartialShallow<T>>, orders?: Many<boolean|"asc"|"desc">): Collection<T>;
1346 }
1347 interface Object<T> {
1348 /**
1349 * @see _.orderBy
1350 */
1351 orderBy(iteratees?: Many<ObjectIterator<T, NotVoid>>, orders?: Many<boolean|"asc"|"desc">): Collection<T[keyof T]>;
1352 }
1353 interface CollectionChain<T> {
1354 /**
1355 * @see _.orderBy
1356 */
1357 orderBy(iteratees?: Many<ListIterator<T, NotVoid> | PropertyName | PartialShallow<T>>, orders?: Many<boolean|"asc"|"desc">): CollectionChain<T>;
1358 }
1359 interface ObjectChain<T> {
1360 /**
1361 * @see _.orderBy
1362 */
1363 orderBy(iteratees?: Many<ObjectIterator<T, NotVoid>>, orders?: Many<boolean|"asc"|"desc">): CollectionChain<T[keyof T]>;
1364 }
1365 interface LoDashStatic {
1366 /**
1367 * Creates an array of elements split into two groups, the first of which contains elements predicate returns truthy for,
1368 * while the second of which contains elements predicate returns falsey for.
1369 * The predicate is invoked with three arguments: (value, index|key, collection).
1370 *
1371 * @param collection The collection to iterate over.
1372 * @param callback The function called per iteration.
1373 * @return Returns the array of grouped elements.
1374 */
1375 partition<T, U extends T>(collection: List<T> | null | undefined, callback: ValueIteratorTypeGuard<T, U>): [U[], Array<Exclude<T, U>>];
1376 /**
1377 * @see _.partition
1378 */
1379 partition<T>(collection: List<T> | null | undefined, callback: ValueIteratee<T>): [T[], T[]];
1380 /**
1381 * @see _.partition
1382 */
1383 partition<T extends object>(collection: T | null | undefined, callback: ValueIteratee<T[keyof T]>): [Array<T[keyof T]>, Array<T[keyof T]>];
1384 }
1385 interface String {
1386 /**
1387 * @see _.partition
1388 */
1389 partition(callback: StringIterator<NotVoid>): LoDashImplicitWrapper<[string[], string[]]>;
1390 }
1391 interface Collection<T> {
1392 /**
1393 * @see _.partition
1394 */
1395 partition<U extends T>(callback: ValueIteratorTypeGuard<T, U>): LoDashImplicitWrapper<[U[], Array<Exclude<T, U>>]>;
1396 /**
1397 * @see _.partition
1398 */
1399 partition(callback: ValueIteratee<T>): LoDashImplicitWrapper<[T[], T[]]>;
1400 }
1401 interface Object<T> {
1402 /**
1403 * @see _.partition
1404 */
1405 partition(callback: ValueIteratee<T[keyof T]>): LoDashImplicitWrapper<[Array<T[keyof T]>, Array<T[keyof T]>]>;
1406 }
1407 interface StringChain {
1408 /**
1409 * @see _.partition
1410 */
1411 partition(callback: StringIterator<NotVoid>): LoDashExplicitWrapper<[string[], string[]]>;
1412 }
1413 interface StringNullableChain {
1414 /**
1415 * @see _.partition
1416 */
1417 partition(callback: StringIterator<NotVoid>): LoDashExplicitWrapper<[string[], string[]]>;
1418 }
1419 interface CollectionChain<T> {
1420 /**
1421 * @see _.partition
1422 */
1423 partition<U extends T>(callback: ValueIteratorTypeGuard<T, U>): LoDashExplicitWrapper<[U[], Array<Exclude<T, U>>]>;
1424 /**
1425 * @see _.partition
1426 */
1427 partition(callback: ValueIteratee<T>): LoDashExplicitWrapper<[T[], T[]]>;
1428 }
1429 interface ObjectChain<T> {
1430 /**
1431 * @see _.partition
1432 */
1433 partition(callback: ValueIteratee<T[keyof T]>): LoDashExplicitWrapper<[Array<T[keyof T]>, Array<T[keyof T]>]>;
1434 }
1435 interface LoDashStatic {
1436 /**
1437 * Reduces a collection to a value which is the accumulated result of running each
1438 * element in the collection through the callback, where each successive callback execution
1439 * consumes the return value of the previous execution. If accumulator is not provided the
1440 * first element of the collection will be used as the initial accumulator value. The callback
1441 * is invoked with four arguments: (accumulator, value, index|key, collection).
1442 * @param collection The collection to iterate over.
1443 * @param callback The function called per iteration.
1444 * @param accumulator Initial value of the accumulator.
1445 * @return Returns the accumulated value.
1446 */
1447 reduce<T, TResult>(collection: T[] | null | undefined, callback: MemoListIterator<T, TResult, T[]>, accumulator: TResult): TResult;
1448 /**
1449 * @see _.reduce
1450 */
1451 reduce<T, TResult>(collection: List<T> | null | undefined, callback: MemoListIterator<T, TResult, List<T>>, accumulator: TResult): TResult;
1452 /**
1453 * @see _.reduce
1454 */
1455 reduce<T extends object, TResult>(collection: T | null | undefined, callback: MemoObjectIterator<T[keyof T], TResult, T>, accumulator: TResult): TResult;
1456 /**
1457 * @see _.reduce
1458 */
1459 reduce<T>(collection: T[] | null | undefined, callback: MemoListIterator<T, T, T[]>): T | undefined;
1460 /**
1461 * @see _.reduce
1462 */
1463 reduce<T>(collection: List<T> | null | undefined, callback: MemoListIterator<T, T, List<T>>): T | undefined;
1464 /**
1465 * @see _.reduce
1466 */
1467 reduce<T extends object>(collection: T | null | undefined, callback: MemoObjectIterator<T[keyof T], T[keyof T], T>): T[keyof T] | undefined;
1468 }
1469 interface Collection<T> {
1470 /**
1471 * @see _.reduce
1472 */
1473 reduce<TResult>(callback: MemoListIterator<T, TResult, List<T>>, accumulator: TResult): TResult;
1474 /**
1475 * @see _.reduce
1476 */
1477 reduce(callback: MemoListIterator<T, T, List<T>>): T | undefined;
1478 }
1479 interface Object<T> {
1480 /**
1481 * @see _.reduce
1482 */
1483 reduce<TResult>(callback: MemoObjectIterator<T[keyof T], TResult, T>, accumulator: TResult): TResult;
1484 /**
1485 * @see _.reduce
1486 */
1487 reduce(callback: MemoObjectIterator<T[keyof T], T[keyof T], T>): T[keyof T] | undefined;
1488 }
1489 interface CollectionChain<T> {
1490 /**
1491 * @see _.reduce
1492 */
1493 reduce<TResult>(callback: MemoListIterator<T, TResult, List<T>>, accumulator: TResult): ExpChain<TResult>;
1494 /**
1495 * @see _.reduce
1496 */
1497 reduce(callback: MemoListIterator<T, T, List<T>>): ExpChain<T | undefined>;
1498 }
1499 interface ObjectChain<T> {
1500 /**
1501 * @see _.reduce
1502 */
1503 reduce<TResult>(callback: MemoObjectIterator<T[keyof T], TResult, T>, accumulator: TResult): ExpChain<TResult>;
1504 /**
1505 * @see _.reduce
1506 */
1507 reduce(callback: MemoObjectIterator<T[keyof T], T[keyof T], T>): ExpChain<T[keyof T] | undefined>;
1508 }
1509 interface LoDashStatic {
1510 /**
1511 * This method is like _.reduce except that it iterates over elements of a collection from
1512 * right to left.
1513 * @param collection The collection to iterate over.
1514 * @param callback The function called per iteration.
1515 * @param accumulator Initial value of the accumulator.
1516 * @return The accumulated value.
1517 */
1518 reduceRight<T, TResult>(collection: T[] | null | undefined, callback: MemoListIterator<T, TResult, T[]>, accumulator: TResult): TResult;
1519 /**
1520 * @see _.reduceRight
1521 */
1522 reduceRight<T, TResult>(collection: List<T> | null | undefined, callback: MemoListIterator<T, TResult, List<T>>, accumulator: TResult): TResult;
1523 /**
1524 * @see _.reduceRight
1525 */
1526 reduceRight<T extends object, TResult>(collection: T | null | undefined, callback: MemoObjectIterator<T[keyof T], TResult, T>, accumulator: TResult): TResult;
1527 /**
1528 * @see _.reduceRight
1529 */
1530 reduceRight<T>(collection: T[] | null | undefined, callback: MemoListIterator<T, T, T[]>): T | undefined;
1531 /**
1532 * @see _.reduceRight
1533 */
1534 reduceRight<T>(collection: List<T> | null | undefined, callback: MemoListIterator<T, T, List<T>>): T | undefined;
1535 /**
1536 * @see _.reduceRight
1537 */
1538 reduceRight<T extends object>(collection: T | null | undefined, callback: MemoObjectIterator<T[keyof T], T[keyof T], T>): T[keyof T] | undefined;
1539 }
1540 interface Collection<T> {
1541 /**
1542 * @see _.reduceRight
1543 */
1544 reduceRight<TResult>(callback: MemoListIterator<T, TResult, List<T>>, accumulator: TResult): TResult;
1545 /**
1546 * @see _.reduceRight
1547 */
1548 reduceRight(callback: MemoListIterator<T, T, List<T>>): T | undefined;
1549 }
1550 interface Object<T> {
1551 /**
1552 * @see _.reduceRight
1553 */
1554 reduceRight<TResult>(callback: MemoObjectIterator<T[keyof T], TResult, T>, accumulator: TResult): TResult;
1555 /**
1556 * @see _.reduceRight
1557 */
1558 reduceRight(callback: MemoObjectIterator<T[keyof T], T[keyof T], T>): T[keyof T] | undefined;
1559 }
1560 interface CollectionChain<T> {
1561 /**
1562 * @see _.reduceRight
1563 */
1564 reduceRight<TResult>(callback: MemoListIterator<T, TResult, List<T>>, accumulator: TResult): ExpChain<TResult>;
1565 /**
1566 * @see _.reduceRight
1567 */
1568 reduceRight(callback: MemoListIterator<T, T, List<T>>): ExpChain<T | undefined>;
1569 }
1570 interface ObjectChain<T> {
1571 /**
1572 * @see _.reduceRight
1573 */
1574 reduceRight<TResult>(callback: MemoObjectIterator<T[keyof T], TResult, T>, accumulator: TResult): ExpChain<TResult>;
1575 /**
1576 * @see _.reduceRight
1577 */
1578 reduceRight(callback: MemoObjectIterator<T[keyof T], T[keyof T], T>): ExpChain<T[keyof T] | undefined>;
1579 }
1580 interface LoDashStatic {
1581 /**
1582 * The opposite of _.filter; this method returns the elements of collection that predicate does not return
1583 * truthy for.
1584 *
1585 * @param collection The collection to iterate over.
1586 * @param predicate The function invoked per iteration.
1587 * @return Returns the new filtered array.
1588 */
1589 reject(collection: string | null | undefined, predicate?: StringIterator<boolean>): string[];
1590 /**
1591 * @see _.reject
1592 */
1593 reject<T>(collection: List<T> | null | undefined, predicate?: ListIterateeCustom<T, boolean>): T[];
1594 /**
1595 * @see _.reject
1596 */
1597 reject<T extends object>(collection: T | null | undefined, predicate?: ObjectIterateeCustom<T, boolean>): Array<T[keyof T]>;
1598 }
1599 interface String {
1600 /**
1601 * @see _.reject
1602 */
1603 reject(predicate?: StringIterator<boolean>): Collection<string>;
1604 }
1605 interface Collection<T> {
1606 /**
1607 * @see _.reject
1608 */
1609 reject(predicate?: ListIterateeCustom<T, boolean>): Collection<T>;
1610 }
1611 interface Object<T> {
1612 /**
1613 * @see _.reject
1614 */
1615 reject(predicate?: ObjectIterateeCustom<T, boolean>): Collection<T[keyof T]>;
1616 }
1617 interface StringChain {
1618 /**
1619 * @see _.reject
1620 */
1621 reject(predicate?: StringIterator<boolean>): CollectionChain<string>;
1622 }
1623 interface StringNullableChain {
1624 /**
1625 * @see _.reject
1626 */
1627 reject(predicate?: StringIterator<boolean>): CollectionChain<string>;
1628 }
1629 interface CollectionChain<T> {
1630 /**
1631 * @see _.reject
1632 */
1633 reject(predicate?: ListIterateeCustom<T, boolean>): CollectionChain<T>;
1634 }
1635 interface ObjectChain<T> {
1636 /**
1637 * @see _.reject
1638 */
1639 reject(predicate?: ObjectIterateeCustom<T, boolean>): CollectionChain<T[keyof T]>;
1640 }
1641 interface LoDashStatic {
1642 /**
1643 * Gets a random element from collection.
1644 *
1645 * @param collection The collection to sample.
1646 * @return Returns the random element.
1647 */
1648 sample<T>(collection: Dictionary<T> | NumericDictionary<T> | null | undefined): T | undefined;
1649 /**
1650 * @see _.sample
1651 */
1652 sample<T extends object>(collection: T | null | undefined): T[keyof T] | undefined;
1653 }
1654 interface String {
1655 /**
1656 * @see _.sample
1657 */
1658 sample(): string | undefined;
1659 }
1660 interface Collection<T> {
1661 /**
1662 * @see _.sample
1663 */
1664 sample(): T | undefined;
1665 }
1666 interface Object<T> {
1667 /**
1668 * @see _.sample
1669 */
1670 sample(): T[keyof T] | undefined;
1671 }
1672 interface StringChain {
1673 /**
1674 * @see _.sample
1675 */
1676 sample(): StringNullableChain;
1677 }
1678 interface StringNullableChain {
1679 /**
1680 * @see _.sample
1681 */
1682 sample(): StringNullableChain;
1683 }
1684 interface CollectionChain<T> {
1685 /**
1686 * @see _.sample
1687 */
1688 sample(): ExpChain<T | undefined>;
1689 }
1690 interface ObjectChain<T> {
1691 /**
1692 * @see _.sample
1693 */
1694 sample(): ExpChain<T[keyof T] | undefined>;
1695 }
1696 interface LoDashStatic {
1697 /**
1698 * Gets n random elements at unique keys from collection up to the size of collection.
1699 *
1700 * @param collection The collection to sample.
1701 * @param n The number of elements to sample.
1702 * @return Returns the random elements.
1703 */
1704 sampleSize<T>(collection: Dictionary<T> | NumericDictionary<T> | null | undefined, n?: number): T[];
1705 /**
1706 * @see _.sampleSize
1707 */
1708 sampleSize<T extends object>(collection: T | null | undefined, n?: number): Array<T[keyof T]>;
1709 }
1710 interface String {
1711 /**
1712 * @see _.sampleSize
1713 */
1714 sampleSize(n?: number): Collection<string>;
1715 }
1716 interface Collection<T> {
1717 /**
1718 * @see _.sampleSize
1719 */
1720 sampleSize(n?: number): Collection<T>;
1721 }
1722 interface Object<T> {
1723 /**
1724 * @see _.sampleSize
1725 */
1726 sampleSize(n?: number): Collection<T[keyof T]>;
1727 }
1728 interface StringChain {
1729 /**
1730 * @see _.sampleSize
1731 */
1732 sampleSize(n?: number): CollectionChain<string>;
1733 }
1734 interface StringNullableChain {
1735 /**
1736 * @see _.sampleSize
1737 */
1738 sampleSize(n?: number): CollectionChain<string>;
1739 }
1740 interface CollectionChain<T> {
1741 /**
1742 * @see _.sampleSize
1743 */
1744 sampleSize(n?: number): CollectionChain<T>;
1745 }
1746 interface ObjectChain<T> {
1747 /**
1748 * @see _.sampleSize
1749 */
1750 sampleSize(n?: number): CollectionChain<T[keyof T]>;
1751 }
1752 interface LoDashStatic {
1753 /**
1754 * Creates an array of shuffled values, using a version of the Fisher-Yates shuffle.
1755 *
1756 * @param collection The collection to shuffle.
1757 * @return Returns the new shuffled array.
1758 */
1759 shuffle<T>(collection: List<T> | null | undefined): T[];
1760 /**
1761 * @see _.shuffle
1762 */
1763 shuffle<T extends object>(collection: T | null | undefined): Array<T[keyof T]>;
1764 }
1765 interface String {
1766 /**
1767 * @see _.shuffle
1768 */
1769 shuffle(): Collection<string>;
1770 }
1771 interface Collection<T> {
1772 /**
1773 * @see _.shuffle
1774 */
1775 shuffle(): Collection<T>;
1776 }
1777 interface Object<T> {
1778 /**
1779 * @see _.shuffle
1780 */
1781 shuffle(): Collection<T[keyof T]>;
1782 }
1783 interface StringChain {
1784 /**
1785 * @see _.shuffle
1786 */
1787 shuffle(): CollectionChain<string>;
1788 }
1789 interface StringNullableChain {
1790 /**
1791 * @see _.shuffle
1792 */
1793 shuffle(): CollectionChain<string>;
1794 }
1795 interface CollectionChain<T> {
1796 /**
1797 * @see _.shuffle
1798 */
1799 shuffle(): CollectionChain<T>;
1800 }
1801 interface ObjectChain<T> {
1802 /**
1803 * @see _.shuffle
1804 */
1805 shuffle(): CollectionChain<T[keyof T]>;
1806 }
1807 interface LoDashStatic {
1808 /**
1809 * Gets the size of collection by returning its length for array-like values or the number of own enumerable
1810 * properties for objects.
1811 *
1812 * @param collection The collection to inspect.
1813 * @return Returns the size of collection.
1814 */
1815 size(collection: object | string | null | undefined): number;
1816 }
1817 interface LoDashImplicitWrapper<TValue> {
1818 /**
1819 * @see _.size
1820 */
1821 size(): number;
1822 }
1823 interface LoDashExplicitWrapper<TValue> {
1824 /**
1825 * @see _.size
1826 */
1827 size(): PrimitiveChain<number>;
1828 }
1829 interface LoDashStatic {
1830 /**
1831 * Checks if predicate returns truthy for any element of collection. Iteration is stopped once predicate
1832 * returns truthy. The predicate is invoked with three arguments: (value, index|key, collection).
1833 *
1834 * @param collection The collection to iterate over.
1835 * @param predicate The function invoked per iteration.
1836 * @return Returns true if any element passes the predicate check, else false.
1837 */
1838 some<T>(collection: List<T> | null | undefined, predicate?: ListIterateeCustom<T, boolean>): boolean;
1839 /**
1840 * @see _.some
1841 */
1842 some<T extends object>(collection: T | null | undefined, predicate?: ObjectIterateeCustom<T, boolean>): boolean;
1843 }
1844 interface Collection<T> {
1845 /**
1846 * @see _.some
1847 */
1848 some(predicate?: ListIterateeCustom<T, boolean>): boolean;
1849 }
1850 interface Object<T> {
1851 /**
1852 * @see _.some
1853 */
1854 some(predicate?: ObjectIterateeCustom<T, boolean>): boolean;
1855 }
1856 interface CollectionChain<T> {
1857 /**
1858 * @see _.some
1859 */
1860 some(predicate?: ListIterateeCustom<T, boolean>): PrimitiveChain<boolean>;
1861 }
1862 interface ObjectChain<T> {
1863 /**
1864 * @see _.some
1865 */
1866 some(predicate?: ObjectIterateeCustom<T, boolean>): PrimitiveChain<boolean>;
1867 }
1868 interface LoDashStatic {
1869 /**
1870 * Creates an array of elements, sorted in ascending order by the results of
1871 * running each element in a collection through each iteratee. This method
1872 * performs a stable sort, that is, it preserves the original sort order of
1873 * equal elements. The iteratees are invoked with one argument: (value).
1874 *
1875 * @category Collection
1876 * @param collection The collection to iterate over.
1877 * @param [iteratees=[_.identity]]
1878 * The iteratees to sort by, specified individually or in arrays.
1879 * @returns Returns the new sorted array.
1880 * @example
1881 *
1882 * var users = [
1883 * { 'user': 'fred', 'age': 48 },
1884 * { 'user': 'barney', 'age': 36 },
1885 * { 'user': 'fred', 'age': 42 },
1886 * { 'user': 'barney', 'age': 34 }
1887 * ];
1888 *
1889 * _.sortBy(users, function(o) { return o.user; });
1890 * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
1891 *
1892 * _.sortBy(users, ['user', 'age']);
1893 * // => objects for [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]]
1894 *
1895 * _.sortBy(users, 'user', function(o) {
1896 * return Math.floor(o.age / 10);
1897 * });
1898 * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
1899 */
1900 sortBy<T>(collection: List<T> | null | undefined, ...iteratees: Array<Many<ListIteratee<T>>>): T[];
1901 /**
1902 * @see _.sortBy
1903 */
1904 sortBy<T extends object>(collection: T | null | undefined, ...iteratees: Array<Many<ObjectIteratee<T>>>): Array<T[keyof T]>;
1905 }
1906 interface Collection<T> {
1907 /**
1908 * @see _.sortBy
1909 */
1910 sortBy(...iteratees: Array<Many<ListIteratee<T>>>): Collection<T>;
1911 }
1912 interface Object<T> {
1913 /**
1914 * @see _.sortBy
1915 */
1916 sortBy(...iteratees: Array<Many<ObjectIteratee<T>>>): Collection<T[keyof T]>;
1917 }
1918 interface CollectionChain<T> {
1919 /**
1920 * @see _.sortBy
1921 */
1922 sortBy(...iteratees: Array<Many<ListIteratee<T>>>): CollectionChain<T>;
1923 }
1924 interface ObjectChain<T> {
1925 /**
1926 * @see _.sortBy
1927 */
1928 sortBy(...iteratees: Array<Many<ObjectIteratee<T>>>): CollectionChain<T[keyof T]>;
1929 }
1930}