UNPKG

41.8 kBTypeScriptView Raw
1import _ = require("../index");
2declare module "../index" {
3 interface LoDashStatic {
4 /**
5 * Attempts to invoke func, returning either the result or the caught error object. Any additional arguments
6 * are provided to func when it’s invoked.
7 *
8 * @param func The function to attempt.
9 * @return Returns the func result or error object.
10 */
11 attempt<TResult>(func: (...args: any[]) => TResult, ...args: any[]): TResult | Error;
12 }
13 interface LoDashImplicitWrapper<TValue> {
14 /**
15 * @see _.attempt
16 */
17 attempt<TResult>(...args: any[]): TResult | Error;
18 }
19 interface LoDashExplicitWrapper<TValue> {
20 /**
21 * @see _.attempt
22 */
23 attempt<TResult>(...args: any[]): ExpChain<TResult | Error>;
24 }
25
26 interface LoDashStatic {
27 /**
28 * Binds methods of an object to the object itself, overwriting the existing method. Method names may be
29 * specified as individual arguments or as arrays of method names. If no method names are provided all
30 * enumerable function properties, own and inherited, of object are bound.
31 *
32 * Note: This method does not set the "length" property of bound functions.
33 *
34 * @param object The object to bind and assign the bound methods to.
35 * @param methodNames The object method names to bind, specified as individual method names or arrays of
36 * method names.
37 * @return Returns object.
38 */
39 bindAll<T>(object: T, ...methodNames: Array<Many<string>>): T;
40 }
41 interface LoDashImplicitWrapper<TValue> {
42 /**
43 * @see _.bindAll
44 */
45 bindAll(...methodNames: Array<Many<string>>): this;
46 }
47 interface LoDashExplicitWrapper<TValue> {
48 /**
49 * @see _.bindAll
50 */
51 bindAll(...methodNames: Array<Many<string>>): this;
52 }
53
54 interface LoDashStatic {
55 /**
56 * Creates a function that iterates over `pairs` and invokes the corresponding
57 * function of the first predicate to return truthy. The predicate-function
58 * pairs are invoked with the `this` binding and arguments of the created
59 * function.
60 *
61 * @since 4.0.0
62 * @category Util
63 * @param pairs The predicate-function pairs.
64 * @returns Returns the new composite function.
65 * @example
66 *
67 * var func = _.cond([
68 * [_.matches({ 'a': 1 }), _.constant('matches A')],
69 * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
70 * [_.stubTrue, _.constant('no match')]
71 * ]);
72 *
73 * func({ 'a': 1, 'b': 2 });
74 * // => 'matches A'
75 *
76 * func({ 'a': 0, 'b': 1 });
77 * // => 'matches B'
78 *
79 * func({ 'a': '1', 'b': '2' });
80 * // => 'no match'
81 */
82 cond<R>(pairs: Array<CondPairNullary<R>>): () => R;
83 cond<T, R>(pairs: Array<CondPairUnary<T, R>>): (Target: T) => R;
84 }
85
86 type ConformsPredicateObject<T> = {
87 [P in keyof T]: T[P] extends (arg: infer A) => any ? A : any
88 };
89 interface LoDashStatic {
90 /**
91 * Creates a function that invokes the predicate properties of `source` with the corresponding
92 * property values of a given object, returning true if all predicates return truthy, else false.
93 */
94 conforms<T>(source: ConformsPredicateObject<T>): (value: T) => boolean;
95 }
96 interface LoDashImplicitWrapper<TValue> {
97 /**
98 * @see _.conforms
99 */
100 conforms(): Function<(value: ConformsPredicateObject<TValue>) => boolean>;
101 }
102 interface LoDashExplicitWrapper<TValue> {
103 /**
104 * @see _.conforms
105 */
106 conforms(): FunctionChain<(value: ConformsPredicateObject<TValue>) => boolean>;
107 }
108
109 interface LoDashStatic {
110 /**
111 * Creates a function that returns value.
112 *
113 * @param value The value to return from the new function.
114 * @return Returns the new function.
115 */
116 constant<T>(value: T): () => T;
117 }
118 interface LoDashImplicitWrapper<TValue> {
119 /**
120 * @see _.constant
121 */
122 constant(): Function<() => TValue>;
123 }
124 interface LoDashExplicitWrapper<TValue> {
125 /**
126 * @see _.constant
127 */
128 constant(): FunctionChain<() => TValue>;
129 }
130
131 interface LoDashStatic {
132 /**
133 * Checks `value` to determine whether a default value should be returned in
134 * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
135 * or `undefined`.
136 *
137 * @param value The value to check.
138 * @param defaultValue The default value.
139 * @returns Returns the resolved value.
140 */
141 defaultTo<T>(value: T | null | undefined, defaultValue: T): T;
142 /**
143 * @see _.defaultTo
144 */
145 defaultTo<T, TDefault>(value: T | null | undefined, defaultValue: TDefault): T | TDefault;
146 }
147 interface LoDashImplicitWrapper<TValue> {
148 /**
149 * @see _.defaultTo
150 */
151 defaultTo(defaultValue: TValue): TValue;
152 /**
153 * @see _.defaultTo
154 */
155 defaultTo<TDefault>(defaultValue: TDefault): TValue extends null | undefined ? TDefault : TValue | TDefault;
156 }
157 interface LoDashExplicitWrapper<TValue> {
158 /**
159 * @see _.defaultTo
160 */
161 defaultTo(defaultValue: TValue): ExpChain<TValue>;
162 /**
163 * @see _.defaultTo
164 */
165 defaultTo<TDefault>(defaultValue: TDefault): ExpChain<TValue extends null | undefined ? TDefault : TValue | TDefault>;
166 }
167
168 interface LoDashStatic {
169 /**
170 * Creates a function that returns the result of invoking the provided functions with the this binding of the
171 * created function, where each successive invocation is supplied the return value of the previous.
172 *
173 * @param funcs Functions to invoke.
174 * @return Returns the new function.
175 */
176 flow<A extends any[], R1, R2, R3, R4, R5, R6, R7>(f1: (...args: A) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7): (...args: A) => R7;
177 /**
178 * @see _.flow
179 */
180 flow<A extends any[], R1, R2, R3, R4, R5, R6, R7>(f1: (...args: A) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7, ...func: Array<Many<(a: any) => any>>): (...args: A) => any;
181 /**
182 * @see _.flow
183 */
184 flow<A extends any[], R1, R2, R3, R4, R5, R6>(f1: (...args: A) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): (...args: A) => R6;
185 /**
186 * @see _.flow
187 */
188 flow<A extends any[], R1, R2, R3, R4, R5>(f1: (...args: A) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): (...args: A) => R5;
189 /**
190 * @see _.flow
191 */
192 flow<A extends any[], R1, R2, R3, R4>(f1: (...args: A) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): (...args: A) => R4;
193 /**
194 * @see _.flow
195 */
196 flow<A extends any[], R1, R2, R3>(f1: (...args: A) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3): (...args: A) => R3;
197 /**
198 * @see _.flow
199 */
200 flow<A extends any[], R1, R2>(f1: (...args: A) => R1, f2: (a: R1) => R2): (...args: A) => R2;
201 /**
202 * @see _.flow
203 */
204 flow(...func: Array<Many<(...args: any[]) => any>>): (...args: any[]) => any;
205 }
206 interface Function<T extends (...arg: any) => any> {
207 /**
208 * @see _.flow
209 */
210 flow<R2, R3, R4, R5, R6, R7>(f2: (a: ReturnType<T>) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7): Function<(...args: Parameters<T>) => R7>;
211 /**
212 * @see _.flow
213 */
214 flow<R2, R3, R4, R5, R6, R7>(f2: (a: ReturnType<T>) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7, ...func: Array<Many<(a: any) => any>>): Function<(...args: Parameters<T>) => any>;
215 /**
216 * @see _.flow
217 */
218 flow<R2, R3, R4, R5, R6>(f2: (a: ReturnType<T>) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): Function<(...args: Parameters<T>) => R6>;
219 /**
220 * @see _.flow
221 */
222 flow<R2, R3, R4, R5>(f2: (a: ReturnType<T>) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): Function<(...args: Parameters<T>) => R5>;
223 /**
224 * @see _.flow
225 */
226 flow<R2, R3, R4>(f2: (a: ReturnType<T>) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): Function<(...args: Parameters<T>) => R4>;
227 /**
228 * @see _.flow
229 */
230 flow<R2, R3>(f2: (a: ReturnType<T>) => R2, f3: (a: R2) => R3): Function<(...args: Parameters<T>) => R3>;
231 /**
232 * @see _.flow
233 */
234 flow<R2>(f2: (a: ReturnType<T>) => R2): Function<(...args: Parameters<T>) => R2>;
235 /**
236 * @see _.flow
237 */
238 flow(...func: Array<Many<(...args: any[]) => any>>): Function<(...args: any[]) => any>;
239 }
240 interface FunctionChain<T> {
241 /**
242 * @see _.flow
243 */
244 flow<R2, R3, R4, R5, R6, R7>(f2: (a: ReturnType<T>) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7): FunctionChain<(...args: Parameters<T>) => R7>;
245 /**
246 * @see _.flow
247 */
248 flow<R2, R3, R4, R5, R6, R7>(f2: (a: ReturnType<T>) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7, ...func: Array<Many<(a: any) => any>>): FunctionChain<(...args: Parameters<T>) => any>;
249 /**
250 * @see _.flow
251 */
252 flow<R2, R3, R4, R5, R6>(f2: (a: ReturnType<T>) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): FunctionChain<(...args: Parameters<T>) => R6>;
253 /**
254 * @see _.flow
255 */
256 flow<R2, R3, R4, R5>(f2: (a: ReturnType<T>) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): FunctionChain<(...args: Parameters<T>) => R5>;
257 /**
258 * @see _.flow
259 */
260 flow<R2, R3, R4>(f2: (a: ReturnType<T>) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): FunctionChain<(...args: Parameters<T>) => R4>;
261 /**
262 * @see _.flow
263 */
264 flow<R2, R3>(f2: (a: ReturnType<T>) => R2, f3: (a: R2) => R3): FunctionChain<(...args: Parameters<T>) => R3>;
265 /**
266 * @see _.flow
267 */
268 flow<R2>(f2: (a: ReturnType<T>) => R2): FunctionChain<(...args: Parameters<T>) => R2>;
269 /**
270 * @see _.flow
271 */
272 flow(...func: Array<Many<(...args: any[]) => any>>): FunctionChain<(...args: any[]) => any>;
273 }
274
275 interface LoDashStatic {
276 /**
277 * This method is like _.flow except that it creates a function that invokes the provided functions from right
278 * to left.
279 *
280 * @param funcs Functions to invoke.
281 * @return Returns the new function.
282 */
283 flowRight<A extends any[], R1, R2, R3, R4, R5, R6, R7>(f7: (a: R6) => R7, f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R7;
284 /**
285 * @see _.flowRight
286 */
287 flowRight<A extends any[], R1, R2, R3, R4, R5, R6>(f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R6;
288 /**
289 * @see _.flowRight
290 */
291 flowRight<A extends any[], R1, R2, R3, R4, R5>(f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R5;
292 /**
293 * @see _.flowRight
294 */
295 flowRight<A extends any[], R1, R2, R3, R4>(f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R4;
296 /**
297 * @see _.flowRight
298 */
299 flowRight<A extends any[], R1, R2, R3>(f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R3;
300 /**
301 * @see _.flowRight
302 */
303 flowRight<A extends any[], R1, R2>(f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R2;
304 /**
305 * @see _.flowRight
306 */
307 flowRight(...func: Array<Many<(...args: any[]) => any>>): (...args: any[]) => any;
308 }
309 interface Function<T> {
310 /**
311 * @see _.flowRight
312 */
313 flowRight<A extends any[], R1, R2, R3, R4, R5>(f6: (a: R5) => Parameters<T>["0"], f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): Function<(...args: A) => ReturnType<T>>;
314 /**
315 * @see _.flowRight
316 */
317 flowRight<A extends any[], R1, R2, R3, R4>(f5: (a: R4) => Parameters<T>["0"], f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): Function<(...args: A) => ReturnType<T>>;
318 /**
319 * @see _.flowRight
320 */
321 flowRight<A extends any[], R1, R2, R3>(f4: (a: R3) => Parameters<T>["0"], f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): Function<(...args: A) => ReturnType<T>>;
322 /**
323 * @see _.flowRight
324 */
325 flowRight<A extends any[], R1, R2>(f3: (a: R2) => Parameters<T>["0"], f2: (a: R1) => R2, f1: (...args: A) => R1): Function<(...args: A) => ReturnType<T>>;
326 /**
327 * @see _.flowRight
328 */
329 flowRight<A extends any[], R1>(f2: (a: R1) => Parameters<T>["0"], f1: (...args: A) => R1): Function<(...args: A) => ReturnType<T>>;
330 /**
331 * @see _.flowRight
332 */
333 flowRight<A extends any[]>(f1: (...args: A) => Parameters<T>["0"]): Function<(...args: A) => ReturnType<T>>;
334 /**
335 * @see _.flowRight
336 */
337 flowRight(...func: Array<Many<(...args: any[]) => any>>): Function<(...args: any[]) => any>;
338 }
339 interface FunctionChain<T> {
340 /**
341 * @see _.flowRight
342 */
343 flowRight<A extends any[], R1, R2, R3, R4, R5>(f6: (a: R5) => Parameters<T>["0"], f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): FunctionChain<(...args: A) => ReturnType<T>>;
344 /**
345 * @see _.flowRight
346 */
347 flowRight<A extends any[], R1, R2, R3, R4>(f5: (a: R4) => Parameters<T>["0"], f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): FunctionChain<(...args: A) => ReturnType<T>>;
348 /**
349 * @see _.flowRight
350 */
351 flowRight<A extends any[], R1, R2, R3>(f4: (a: R3) => Parameters<T>["0"], f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): FunctionChain<(...args: A) => ReturnType<T>>;
352 /**
353 * @see _.flowRight
354 */
355 flowRight<A extends any[], R1, R2>(f3: (a: R2) => Parameters<T>["0"], f2: (a: R1) => R2, f1: (...args: A) => R1): FunctionChain<(...args: A) => ReturnType<T>>;
356 /**
357 * @see _.flowRight
358 */
359 flowRight<A extends any[], R1>(f2: (a: R1) => Parameters<T>["0"], f1: (...args: A) => R1): FunctionChain<(...args: A) => ReturnType<T>>;
360 /**
361 * @see _.flowRight
362 */
363 flowRight<A extends any[]>(f1: (...args: A) => Parameters<T>["0"]): FunctionChain<(...args: A) => ReturnType<T>>;
364 /**
365 * @see _.flowRight
366 */
367 flowRight(...func: Array<Many<(...args: any[]) => any>>): FunctionChain<(...args: any[]) => any>;
368 }
369
370 interface LoDashStatic {
371 /**
372 * This method returns the first argument provided to it.
373 *
374 * @param value Any value.
375 * @return Returns value.
376 */
377 identity<T>(value: T): T;
378 /**
379 * @see _.identity
380 */
381 identity(): undefined;
382 }
383 interface LoDashImplicitWrapper<TValue> {
384 /**
385 * @see _.identity
386 */
387 identity(): TValue;
388 }
389 interface LoDashExplicitWrapper<TValue> {
390 /**
391 * @see _.identity
392 */
393 identity(): this;
394 }
395
396 interface LoDashStatic {
397 /**
398 * Creates a function that invokes `func` with the arguments of the created
399 * function. If `func` is a property name the created callback returns the
400 * property value for a given element. If `func` is an object the created
401 * callback returns `true` for elements that contain the equivalent object properties, otherwise it returns `false`.
402 *
403 * @category Util
404 * @param [func=_.identity] The value to convert to a callback.
405 * @returns Returns the callback.
406 * @example
407 *
408 * var users = [
409 * { 'user': 'barney', 'age': 36 },
410 * { 'user': 'fred', 'age': 40 }
411 * ];
412 *
413 * // create custom iteratee shorthands
414 * _.iteratee = _.wrap(_.iteratee, function(callback, func) {
415 * var p = /^(\S+)\s*([<>])\s*(\S+)$/.exec(func);
416 * return !p ? callback(func) : function(object) {
417 * return (p[2] == '>' ? object[p[1]] > p[3] : object[p[1]] < p[3]);
418 * };
419 * });
420 *
421 * _.filter(users, 'age > 36');
422 * // => [{ 'user': 'fred', 'age': 40 }]
423 */
424 iteratee<TFunction extends (...args: any[]) => any>(func: TFunction): TFunction;
425 /**
426 * @see _.iteratee
427 */
428 iteratee(func: symbol | number | string | object): (...args: any[]) => any;
429 }
430 interface Function<T extends (...args: any) => any> {
431 /**
432 * @see _.iteratee
433 */
434 iteratee(): Function<T>;
435 }
436 interface Collection<T> {
437 /**
438 * @see _.iteratee
439 */
440 iteratee(): Function<(o: object) => boolean>;
441 }
442 interface Object<T> {
443 /**
444 * @see _.iteratee
445 */
446 iteratee(): Function<(o: T) => boolean>;
447 }
448 interface String {
449 /**
450 * @see _.iteratee
451 */
452 iteratee(): Function<(o: object) => any>;
453 }
454 interface FunctionChain<T extends (...args: any) => any> {
455 /**
456 * @see _.iteratee
457 */
458 iteratee(): FunctionChain<T>;
459 }
460 interface CollectionChain<T> {
461 /**
462 * @see _.iteratee
463 */
464 iteratee(): FunctionChain<(o: object) => boolean>;
465 }
466 interface ObjectChain<T> {
467 /**
468 * @see _.iteratee
469 */
470 iteratee(): FunctionChain<(o: T) => boolean>;
471 }
472 interface StringChain {
473 /**
474 * @see _.iteratee
475 */
476 iteratee(): FunctionChain<(o: object) => any>;
477 }
478 interface StringNullableChain {
479 /**
480 * @see _.iteratee
481 */
482 iteratee(): FunctionChain<(o: object) => any>;
483 }
484
485 interface LoDashStatic {
486 /**
487 * Creates a function that performs a deep comparison between a given object and source, returning true if the
488 * given object has equivalent property values, else false.
489 *
490 * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, and
491 * strings. Objects are compared by their own, not inherited, enumerable properties. For comparing a single own
492 * or inherited property value see _.matchesProperty.
493 *
494 * @param source The object of property values to match.
495 * @return Returns the new function.
496 */
497 matches<T>(source: T): (value: any) => boolean;
498 /**
499 * @see _.matches
500 */
501 matches<T, V>(source: T): (value: V) => boolean;
502 }
503 interface LoDashImplicitWrapper<TValue> {
504 /**
505 * @see _.matches
506 */
507 matches<V>(): Function<(value: V) => boolean>;
508 }
509 interface LoDashExplicitWrapper<TValue> {
510 /**
511 * @see _.matches
512 */
513 matches<V>(): FunctionChain<(value: V) => boolean>;
514 }
515
516 interface LoDashStatic {
517 /**
518 * Creates a function that compares the property value of path on a given object to value.
519 *
520 * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, and
521 * strings. Objects are compared by their own, not inherited, enumerable properties.
522 *
523 * @param path The path of the property to get.
524 * @param srcValue The value to match.
525 * @return Returns the new function.
526 */
527 matchesProperty<T>(path: PropertyPath, srcValue: T): (value: any) => boolean;
528 /**
529 * @see _.matchesProperty
530 */
531 matchesProperty<T, V>(path: PropertyPath, srcValue: T): (value: V) => boolean;
532 }
533 interface LoDashImplicitWrapper<TValue> {
534 /**
535 * @see _.matchesProperty
536 */
537 matchesProperty<SrcValue>(srcValue: SrcValue): Function<(value: any) => boolean>;
538 /**
539 * @see _.matchesProperty
540 */
541 matchesProperty<SrcValue, Value>(srcValue: SrcValue): Function<(value: Value) => boolean>;
542 }
543 interface LoDashExplicitWrapper<TValue> {
544 /**
545 * @see _.matchesProperty
546 */
547 matchesProperty<SrcValue>(srcValue: SrcValue): FunctionChain<(value: any) => boolean>;
548 /**
549 * @see _.matchesProperty
550 */
551 matchesProperty<SrcValue, Value>(srcValue: SrcValue): FunctionChain<(value: Value) => boolean>;
552 }
553
554 interface LoDashStatic {
555 /**
556 * Creates a function that invokes the method at path on a given object. Any additional arguments are provided
557 * to the invoked method.
558 *
559 * @param path The path of the method to invoke.
560 * @param args The arguments to invoke the method with.
561 * @return Returns the new function.
562 */
563 method(path: PropertyPath, ...args: any[]): (object: any) => any;
564 }
565 interface LoDashImplicitWrapper<TValue> {
566 /**
567 * @see _.method
568 */
569 method(...args: any[]): Function<(object: any) => any>;
570 }
571 interface LoDashExplicitWrapper<TValue> {
572 /**
573 * @see _.method
574 */
575 method(...args: any[]): FunctionChain<(object: any) => any>;
576 }
577
578 interface LoDashStatic {
579 /**
580 * The opposite of _.method; this method creates a function that invokes the method at a given path on object.
581 * Any additional arguments are provided to the invoked method.
582 *
583 * @param object The object to query.
584 * @param args The arguments to invoke the method with.
585 * @return Returns the new function.
586 */
587 methodOf(object: object, ...args: any[]): (path: PropertyPath) => any;
588 }
589 interface LoDashImplicitWrapper<TValue> {
590 /**
591 * @see _.methodOf
592 */
593 methodOf(...args: any[]): LoDashImplicitWrapper<(path: PropertyPath) => any>;
594 }
595 interface LoDashExplicitWrapper<TValue> {
596 /**
597 * @see _.methodOf
598 */
599 methodOf(...args: any[]): LoDashExplicitWrapper<(path: PropertyPath) => any>;
600 }
601
602 interface MixinOptions {
603 /**
604 * @see _.chain
605 */
606 chain?: boolean | undefined;
607 }
608 interface LoDashStatic {
609 /**
610 * Adds all own enumerable function properties of a source object to the destination object. If object is a
611 * function then methods are added to its prototype as well.
612 *
613 * Note: Use _.runInContext to create a pristine lodash function to avoid conflicts caused by modifying
614 * the original.
615 *
616 * @param object The destination object.
617 * @param source The object of functions to add.
618 * @param options The options object.
619 * @param options.chain Specify whether the functions added are chainable.
620 * @return Returns object.
621 */
622 mixin<TObject>(object: TObject, source: Dictionary<(...args: any[]) => any>, options?: MixinOptions): TObject;
623 /**
624 * @see _.mixin
625 */
626 mixin<TResult>(source: Dictionary<(...args: any[]) => any>, options?: MixinOptions): LoDashStatic;
627 }
628 interface LoDashImplicitWrapper<TValue> {
629 /**
630 * @see _.mixin
631 */
632 mixin(source: Dictionary<(...args: any[]) => any>, options?: MixinOptions): this;
633 /**
634 * @see _.mixin
635 */
636 mixin(options?: MixinOptions): LoDashImplicitWrapper<LoDashStatic>;
637 }
638 interface LoDashExplicitWrapper<TValue> {
639 /**
640 * @see _.mixin
641 */
642 mixin(source: Dictionary<(...args: any[]) => any>, options?: MixinOptions): this;
643 /**
644 * @see _.mixin
645 */
646 mixin(options?: MixinOptions): LoDashExplicitWrapper<LoDashStatic>;
647 }
648
649 interface LoDashStatic {
650 /**
651 * Reverts the _ variable to its previous value and returns a reference to the lodash function.
652 *
653 * @return Returns the lodash function.
654 */
655 noConflict(): typeof _;
656 }
657 interface LoDashImplicitWrapper<TValue> {
658 /**
659 * @see _.noConflict
660 */
661 noConflict(): typeof _;
662 }
663 interface LoDashExplicitWrapper<TValue> {
664 /**
665 * @see _.noConflict
666 */
667 noConflict(): LoDashExplicitWrapper<typeof _>;
668 }
669
670 interface LoDashStatic {
671 /**
672 * A no-operation function that returns undefined regardless of the arguments it receives.
673 *
674 * @return undefined
675 */
676 noop(...args: any[]): void;
677 }
678 interface LoDashImplicitWrapper<TValue> {
679 /**
680 * @see _.noop
681 */
682 noop(...args: any[]): void;
683 }
684 interface LoDashExplicitWrapper<TValue> {
685 /**
686 * @see _.noop
687 */
688 noop(...args: any[]): PrimitiveChain<undefined>;
689 }
690
691 interface LoDashStatic {
692 /**
693 * Creates a function that returns its nth argument.
694 *
695 * @param n The index of the argument to return.
696 * @return Returns the new function.
697 */
698 nthArg(n?: number): (...args: any[]) => any;
699 }
700 interface LoDashImplicitWrapper<TValue> {
701 /**
702 * @see _.nthArg
703 */
704 nthArg(): Function<(...args: any[]) => any>;
705 }
706 interface LoDashExplicitWrapper<TValue> {
707 /**
708 * @see _.nthArg
709 */
710 nthArg(): FunctionChain<(...args: any[]) => any>;
711 }
712
713 interface LoDashStatic {
714 /**
715 * Creates a function that invokes iteratees with the arguments provided to the created function and returns
716 * their results.
717 *
718 * @param iteratees The iteratees to invoke.
719 * @return Returns the new function.
720 */
721 over<TResult>(...iteratees: Array<Many<(...args: any[]) => TResult>>): (...args: any[]) => TResult[];
722 }
723 interface Collection<T> {
724 /**
725 * @see _.over
726 */
727 over<TResult>(...iteratees: Array<Many<(...args: any[]) => TResult>>): Function<(...args: any[]) => TResult[]>;
728 }
729 interface Function<T> {
730 /**
731 * @see _.over
732 */
733 over<TResult>(...iteratees: Array<Many<(...args: any[]) => TResult>>): Function<(...args: any[]) => Array<ReturnType<T> | TResult>>;
734 }
735 interface CollectionChain<T> {
736 /**
737 * @see _.over
738 */
739 over<TResult>(...iteratees: Array<Many<(...args: any[]) => TResult>>): FunctionChain<(...args: any[]) => TResult[]>;
740 }
741 interface FunctionChain<T> {
742 /**
743 * @see _.over
744 */
745 over<TResult>(...iteratees: Array<Many<(...args: any[]) => TResult>>): FunctionChain<(...args: any[]) => Array<ReturnType<T> | TResult>>;
746 }
747
748 interface LoDashStatic {
749 /**
750 * Creates a function that checks if all of the predicates return truthy when invoked with the arguments
751 * provided to the created function.
752 *
753 * @param predicates The predicates to check.
754 * @return Returns the new function.
755 */
756 overEvery<T, Result1 extends T, Result2 extends T>(...predicates: [
757 (arg: T) => arg is Result1,
758 (arg: T) => arg is Result2
759 ]): (arg: T) => arg is Result1 & Result2;
760 overEvery<T>(...predicates: Array<Many<(...args: T[]) => boolean>>): (...args: T[]) => boolean;
761 }
762 interface Collection<T> {
763 /**
764 * @see _.overEvery
765 */
766 overEvery<TArgs>(...iteratees: Array<Many<(...args: TArgs[]) => boolean>>): Function<(...args: TArgs[]) => boolean>;
767 }
768 interface Function<T> {
769 /**
770 * @see _.overEvery
771 */
772 overEvery<TArgs>(...iteratees: Array<Many<(...args: TArgs[]) => boolean>>): Function<(...args: Parameters<T> | TArgs[]) => boolean>;
773 }
774 interface CollectionChain<T> {
775 /**
776 * @see _.overEvery
777 */
778 overEvery<TArgs>(...iteratees: Array<Many<(...args: TArgs[]) => boolean>>): FunctionChain<(...args: TArgs[]) => boolean>;
779 }
780 interface FunctionChain<T> {
781 /**
782 * @see _.overEvery
783 */
784 overEvery<TArgs>(...iteratees: Array<Many<(...args: TArgs[]) => boolean>>): FunctionChain<(...args: Parameters<T> | TArgs[]) => boolean>;
785 }
786
787 interface LoDashStatic {
788 /**
789 * Creates a function that checks if any of the predicates return truthy when invoked with the arguments
790 * provided to the created function.
791 *
792 * @param predicates The predicates to check.
793 * @return Returns the new function.
794 */
795 overSome<T, Result1 extends T, Result2 extends T>(...predicates: [
796 (arg: T) => arg is Result1,
797 (arg: T) => arg is Result2
798 ]): (arg: T) => arg is Result1 | Result2;
799 overSome<T>(...predicates: Array<Many<(...args: T[]) => boolean>>): (...args: T[]) => boolean;
800 }
801 interface Collection<T> {
802 /**
803 * @see _.overSome
804 */
805 overSome<TArgs>(...iteratees: Array<Many<(...args: TArgs[]) => boolean>>): Function<(...args: TArgs[]) => boolean>;
806 }
807 interface Function<T> {
808 /**
809 * @see _.overSome
810 */
811 overSome<TArgs>(...iteratees: Array<Many<(...args: TArgs[]) => boolean>>): Function<(...args: Parameters<T> | TArgs[]) => boolean>;
812 }
813 interface CollectionChain<T> {
814 /**
815 * @see _.overSome
816 */
817 overSome<TArgs>(...iteratees: Array<Many<(...args: TArgs[]) => boolean>>): FunctionChain<(...args: TArgs[]) => boolean>;
818 }
819 interface FunctionChain<T> {
820 /**
821 * @see _.overSome
822 */
823 overSome<TArgs>(...iteratees: Array<Many<(...args: TArgs[]) => boolean>>): FunctionChain<(...args: Parameters<T> | TArgs[]) => boolean>;
824 }
825
826 interface LoDashStatic {
827 /**
828 * Creates a function that returns the property value at path on a given object.
829 *
830 * @param path The path of the property to get.
831 * @return Returns the new function.
832 */
833 property<TObj, TResult>(path: PropertyPath): (obj: TObj) => TResult;
834 }
835 interface LoDashImplicitWrapper<TValue> {
836 /**
837 * @see _.property
838 */
839 property<TObj, TResult>(): Function<(obj: TObj) => TResult>;
840 }
841 interface LoDashExplicitWrapper<TValue> {
842 /**
843 * @see _.property
844 */
845 property<TObj, TResult>(): FunctionChain<(obj: TObj) => TResult>;
846 }
847
848 interface LoDashStatic {
849 /**
850 * The opposite of _.property; this method creates a function that returns the property value at a given path
851 * on object.
852 *
853 * @param object The object to query.
854 * @return Returns the new function.
855 */
856 propertyOf<T extends {}>(object: T): (path: PropertyPath) => any;
857 }
858 interface LoDashImplicitWrapper<TValue> {
859 /**
860 * @see _.propertyOf
861 */
862 propertyOf(): LoDashImplicitWrapper<(path: PropertyPath) => any>;
863 }
864 interface LoDashExplicitWrapper<TValue> {
865 /**
866 * @see _.propertyOf
867 */
868 propertyOf(): LoDashExplicitWrapper<(path: PropertyPath) => any>;
869 }
870
871 interface LoDashStatic {
872 /**
873 * Creates an array of numbers (positive and/or negative) progressing from start up to, but not including, end.
874 * If end is not specified it’s set to start with start then set to 0. If end is less than start a zero-length
875 * range is created unless a negative step is specified.
876 *
877 * @param start The start of the range.
878 * @param end The end of the range.
879 * @param step The value to increment or decrement by.
880 * @return Returns a new range array.
881 */
882 range(start: number, end?: number, step?: number): number[];
883 /**
884 * @see _.range
885 */
886 range(end: number, index: string | number, guard: object): number[];
887 }
888 interface LoDashImplicitWrapper<TValue> {
889 /**
890 * @see _.range
891 */
892 range(end?: number, step?: number): Collection<number>;
893 }
894 interface LoDashExplicitWrapper<TValue> {
895 /**
896 * @see _.range
897 */
898 range(end?: number, step?: number): CollectionChain<number>;
899 }
900
901 interface LoDashStatic {
902 /**
903 * This method is like `_.range` except that it populates values in
904 * descending order.
905 *
906 * @category Util
907 * @param start The start of the range.
908 * @param end The end of the range.
909 * @param step The value to increment or decrement by.
910 * @returns Returns the new array of numbers.
911 * @example
912 *
913 * _.rangeRight(4);
914 * // => [3, 2, 1, 0]
915 *
916 * _.rangeRight(-4);
917 * // => [-3, -2, -1, 0]
918 *
919 * _.rangeRight(1, 5);
920 * // => [4, 3, 2, 1]
921 *
922 * _.rangeRight(0, 20, 5);
923 * // => [15, 10, 5, 0]
924 *
925 * _.rangeRight(0, -4, -1);
926 * // => [-3, -2, -1, 0]
927 *
928 * _.rangeRight(1, 4, 0);
929 * // => [1, 1, 1]
930 *
931 * _.rangeRight(0);
932 * // => []
933 */
934 rangeRight(start: number, end?: number, step?: number): number[];
935 /**
936 * @see _.rangeRight
937 */
938 rangeRight(end: number, index: string | number, guard: object): number[];
939 }
940 interface LoDashImplicitWrapper<TValue> {
941 /**
942 * @see _.rangeRight
943 */
944 rangeRight(end?: number, step?: number): Collection<number>;
945 }
946 interface LoDashExplicitWrapper<TValue> {
947 /**
948 * @see _.rangeRight
949 */
950 rangeRight(end?: number, step?: number): CollectionChain<number>;
951 }
952
953 interface LoDashStatic {
954 /**
955 * Create a new pristine lodash function using the given context object.
956 *
957 * @param context The context object.
958 * @return Returns a new lodash function.
959 */
960 runInContext(context?: object): LoDashStatic;
961 }
962 interface LoDashImplicitWrapper<TValue> {
963 /**
964 * @see _.runInContext
965 */
966 runInContext(): LoDashStatic;
967 }
968
969 interface LoDashStatic {
970 /**
971 * This method returns a new empty array.
972 *
973 * @returns Returns the new empty array.
974 */
975 stubArray(): any[];
976 }
977 interface LoDashImplicitWrapper<TValue> {
978 /**
979 * @see _.stubArray
980 */
981 stubArray(): any[];
982 }
983 interface LoDashExplicitWrapper<TValue> {
984 /**
985 * @see _.stubArray
986 */
987 stubArray(): CollectionChain<any>;
988 }
989
990 interface LoDashStatic {
991 /**
992 * This method returns `false`.
993 *
994 * @returns Returns `false`.
995 */
996 stubFalse(): false;
997 }
998 interface LoDashImplicitWrapper<TValue> {
999 /**
1000 * @see _.stubFalse
1001 */
1002 stubFalse(): false;
1003 }
1004 interface LoDashExplicitWrapper<TValue> {
1005 /**
1006 * @see _.stubFalse
1007 */
1008 stubFalse(): PrimitiveChain<false>;
1009 }
1010
1011 interface LoDashStatic {
1012 /**
1013 * This method returns a new empty object.
1014 *
1015 * @returns Returns the new empty object.
1016 */
1017 stubObject(): any;
1018 }
1019 interface LoDashImplicitWrapper<TValue> {
1020 /**
1021 * @see _.stubObject
1022 */
1023 stubObject(): any;
1024 }
1025 interface LoDashExplicitWrapper<TValue> {
1026 /**
1027 * @see _.stubObject
1028 */
1029 stubObject(): LoDashExplicitWrapper<any>;
1030 }
1031
1032 interface LoDashStatic {
1033 /**
1034 * This method returns an empty string.
1035 *
1036 * @returns Returns the empty string.
1037 */
1038 stubString(): string;
1039 }
1040 interface LoDashImplicitWrapper<TValue> {
1041 /**
1042 * @see _.stubString
1043 */
1044 stubString(): string;
1045 }
1046 interface LoDashExplicitWrapper<TValue> {
1047 /**
1048 * @see _.stubString
1049 */
1050 stubString(): StringChain;
1051 }
1052
1053 interface LoDashStatic {
1054 /**
1055 * This method returns `true`.
1056 *
1057 * @returns Returns `true`.
1058 */
1059 stubTrue(): true;
1060 }
1061 interface LoDashImplicitWrapper<TValue> {
1062 /**
1063 * @see _.stubTrue
1064 */
1065 stubTrue(): true;
1066 }
1067 interface LoDashExplicitWrapper<TValue> {
1068 /**
1069 * @see _.stubTrue
1070 */
1071 stubTrue(): PrimitiveChain<true>;
1072 }
1073
1074 interface LoDashStatic {
1075 /**
1076 * Invokes the iteratee function n times, returning an array of the results of each invocation. The iteratee
1077 * is invoked with one argument; (index).
1078 *
1079 * @param n The number of times to invoke iteratee.
1080 * @param iteratee The function invoked per iteration.
1081 * @return Returns the array of results.
1082 */
1083 times<TResult>(n: number, iteratee: (num: number) => TResult): TResult[];
1084 /**
1085 * @see _.times
1086 */
1087 times(n: number): number[];
1088 }
1089 interface LoDashImplicitWrapper<TValue> {
1090 /**
1091 * @see _.times
1092 */
1093 times<TResult>(iteratee: (num: number) => TResult): TResult[];
1094 /**
1095 * @see _.times
1096 */
1097 times(): number[];
1098 }
1099 interface LoDashExplicitWrapper<TValue> {
1100 /**
1101 * @see _.times
1102 */
1103 times<TResult>(iteratee: (num: number) => TResult): CollectionChain<TResult>;
1104 /**
1105 * @see _.times
1106 */
1107 times(): CollectionChain<number>;
1108 }
1109
1110 interface LoDashStatic {
1111 /**
1112 * Converts `value` to a property path array.
1113 *
1114 * @category Util
1115 * @param value The value to convert.
1116 * @returns Returns the new property path array.
1117 * @example
1118 *
1119 * _.toPath('a.b.c');
1120 * // => ['a', 'b', 'c']
1121 *
1122 * _.toPath('a[0].b.c');
1123 * // => ['a', '0', 'b', 'c']
1124 *
1125 * var path = ['a', 'b', 'c'],
1126 * newPath = _.toPath(path);
1127 *
1128 * console.log(newPath);
1129 * // => ['a', 'b', 'c']
1130 *
1131 * console.log(path === newPath);
1132 * // => false
1133 */
1134 toPath(value: any): string[];
1135 }
1136 interface LoDashImplicitWrapper<TValue> {
1137 /**
1138 * @see _.toPath
1139 */
1140 toPath(): Collection<string>;
1141 }
1142 interface LoDashExplicitWrapper<TValue> {
1143 /**
1144 * @see _.toPath
1145 */
1146 toPath(): CollectionChain<string>;
1147 }
1148
1149 interface LoDashStatic {
1150 /**
1151 * Generates a unique ID. If prefix is provided the ID is appended to it.
1152 *
1153 * @param prefix The value to prefix the ID with.
1154 * @return Returns the unique ID.
1155 */
1156 uniqueId(prefix?: string): string;
1157 }
1158 interface LoDashImplicitWrapper<TValue> {
1159 /**
1160 * @see _.uniqueId
1161 */
1162 uniqueId(): string;
1163 }
1164 interface LoDashExplicitWrapper<TValue> {
1165 /**
1166 * @see _.uniqueId
1167 */
1168 uniqueId(): StringChain;
1169 }
1170
1171 // stubTrue
1172
1173 interface LoDashStatic {
1174 /**
1175 * This method returns true.
1176 *
1177 * @return Returns true.
1178 */
1179 stubTrue(): true;
1180 }
1181
1182 interface LoDashImplicitWrapper<TValue> {
1183 /**
1184 * @see _.stubTrue
1185 */
1186 stubTrue(): true;
1187 }
1188
1189 interface LoDashExplicitWrapper<TValue> {
1190 /**
1191 * @see _.stubTrue
1192 */
1193 stubTrue(): LoDashExplicitWrapper<true>;
1194 }
1195
1196 // stubFalse
1197
1198 interface LoDashStatic {
1199 /**
1200 * This method returns false.
1201 *
1202 * @return Returns false.
1203 */
1204 stubFalse(): false;
1205 }
1206
1207 interface LoDashImplicitWrapper<TValue> {
1208 /**
1209 * @see _.stubFalse
1210 */
1211 stubFalse(): false;
1212 }
1213
1214 interface LoDashExplicitWrapper<TValue> {
1215 /**
1216 * @see _.stubFalse
1217 */
1218 stubFalse(): LoDashExplicitWrapper<false>;
1219 }
1220}