1 | // Type definitions for Lo-Dash
|
2 | // Project: http://lodash.com/
|
3 | // Definitions by: Brian Zengel <https://github.com/bczengel>
|
4 | // Definitions: https://github.com/borisyankov/DefinitelyTyped
|
5 |
|
6 | declare var _: _.LoDashStatic;
|
7 |
|
8 | declare module _ {
|
9 | interface LoDashStatic {
|
10 | /**
|
11 | * Creates a lodash object which wraps the given value to enable intuitive method chaining.
|
12 | *
|
13 | * In addition to Lo-Dash methods, wrappers also have the following Array methods:
|
14 | * concat, join, pop, push, reverse, shift, slice, sort, splice, and unshift
|
15 | *
|
16 | * Chaining is supported in custom builds as long as the value method is implicitly or
|
17 | * explicitly included in the build.
|
18 | *
|
19 | * The chainable wrapper functions are:
|
20 | * after, assign, bind, bindAll, bindKey, chain, compact, compose, concat, countBy,
|
21 | * createCallback, curry, debounce, defaults, defer, delay, difference, filter, flatten,
|
22 | * forEach, forEachRight, forIn, forInRight, forOwn, forOwnRight, functions, groupBy,
|
23 | * indexBy, initial, intersection, invert, invoke, keys, map, max, memoize, merge, min,
|
24 | * object, omit, once, pairs, partial, partialRight, pick, pluck, pull, push, range, reject,
|
25 | * remove, rest, reverse, shuffle, slice, sort, sortBy, splice, tap, throttle, times,
|
26 | * toArray, transform, union, uniq, unshift, unzip, values, where, without, wrap, and zip
|
27 | *
|
28 | * The non-chainable wrapper functions are:
|
29 | * clone, cloneDeep, contains, escape, every, find, findIndex, findKey, findLast,
|
30 | * findLastIndex, findLastKey, has, identity, indexOf, isArguments, isArray, isBoolean,
|
31 | * isDate, isElement, isEmpty, isEqual, isFinite, isFunction, isNaN, isNull, isNumber,
|
32 | * isObject, isPlainObject, isRegExp, isString, isUndefined, join, lastIndexOf, mixin,
|
33 | * noConflict, parseInt, pop, random, reduce, reduceRight, result, shift, size, some,
|
34 | * sortedIndex, runInContext, template, unescape, uniqueId, and value
|
35 | *
|
36 | * The wrapper functions first and last return wrapped values when n is provided, otherwise
|
37 | * they return unwrapped values.
|
38 | *
|
39 | * Explicit chaining can be enabled by using the _.chain method.
|
40 | **/
|
41 | (value: number): LoDashWrapper<number>;
|
42 | (value: string): LoDashWrapper<string>;
|
43 | (value: boolean): LoDashWrapper<boolean>;
|
44 | <T>(value: Array<T>): LoDashArrayWrapper<T>;
|
45 | <T extends {}>(value: T): LoDashObjectWrapper<T>;
|
46 | (value: any): LoDashWrapper<any>;
|
47 |
|
48 | /**
|
49 | * The semantic version number.
|
50 | **/
|
51 | VERSION: string;
|
52 |
|
53 | /**
|
54 | * An object used to flag environments features.
|
55 | **/
|
56 | support: Support;
|
57 |
|
58 | /**
|
59 | * By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby
|
60 | * (ERB). Change the following template settings to use alternative delimiters.
|
61 | **/
|
62 | templateSettings: TemplateSettings;
|
63 | }
|
64 |
|
65 | /**
|
66 | * By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby
|
67 | * (ERB). Change the following template settings to use alternative delimiters.
|
68 | **/
|
69 | interface TemplateSettings {
|
70 | /**
|
71 | * The "escape" delimiter.
|
72 | **/
|
73 | escape?: RegExp;
|
74 |
|
75 | /**
|
76 | * The "evaluate" delimiter.
|
77 | **/
|
78 | evaluate?: RegExp;
|
79 |
|
80 | /**
|
81 | * An object to import into the template as local variables.
|
82 | **/
|
83 | imports?: Dictionary<any>;
|
84 |
|
85 | /**
|
86 | * The "interpolate" delimiter.
|
87 | **/
|
88 | interpolate?: RegExp;
|
89 |
|
90 | /**
|
91 | * Used to reference the data object in the template text.
|
92 | **/
|
93 | variable?: string;
|
94 | }
|
95 |
|
96 | /**
|
97 | * An object used to flag environments features.
|
98 | **/
|
99 | interface Support {
|
100 | /**
|
101 | * Detect if an arguments object’s [[Class]] is resolvable (all but Firefox < 4, IE < 9).
|
102 | **/
|
103 | argsClass: boolean;
|
104 |
|
105 | /**
|
106 | * Detect if arguments objects are Object objects (all but Narwhal and Opera < 10.5).
|
107 | **/
|
108 | argsObject: boolean;
|
109 |
|
110 | /**
|
111 | * Detect if name or message properties of Error.prototype are enumerable by default.
|
112 | * (IE < 9, Safari < 5.1)
|
113 | **/
|
114 | enumErrorProps: boolean;
|
115 |
|
116 | /**
|
117 | * Detect if Function#bind exists and is inferred to be fast (all but V8).
|
118 | **/
|
119 | fastBind: boolean;
|
120 |
|
121 | /**
|
122 | * Detect if functions can be decompiled by Function#toString (all but PS3 and older Opera
|
123 | * mobile browsers & avoided in Windows 8 apps).
|
124 | **/
|
125 | funcDecomp: boolean;
|
126 |
|
127 | /**
|
128 | * Detect if Function#name is supported (all but IE).
|
129 | **/
|
130 | funcNames: boolean;
|
131 |
|
132 | /**
|
133 | * Detect if arguments object indexes are non-enumerable (Firefox < 4, IE < 9, PhantomJS,
|
134 | * Safari < 5.1).
|
135 | **/
|
136 | nonEnumArgs: boolean;
|
137 |
|
138 | /**
|
139 | * Detect if properties shadowing those on Object.prototype are non-enumerable.
|
140 | *
|
141 | * In IE < 9 an objects own properties, shadowing non-enumerable ones, are made
|
142 | * non-enumerable as well (a.k.a the JScript [[DontEnum]] bug).
|
143 | **/
|
144 | nonEnumShadows: boolean;
|
145 |
|
146 | /**
|
147 | * Detect if own properties are iterated after inherited properties (all but IE < 9).
|
148 | **/
|
149 | ownLast: boolean;
|
150 |
|
151 | /**
|
152 | * Detect if Array#shift and Array#splice augment array-like objects correctly.
|
153 | *
|
154 | * Firefox < 10, IE compatibility mode, and IE < 9 have buggy Array shift() and splice()
|
155 | * functions that fail to remove the last element, value[0], of array-like objects even
|
156 | * though the length property is set to 0. The shift() method is buggy in IE 8 compatibility
|
157 | * mode, while splice() is buggy regardless of mode in IE < 9 and buggy in compatibility mode
|
158 | * in IE 9.
|
159 | **/
|
160 | spliceObjects: boolean;
|
161 |
|
162 | /**
|
163 | * Detect lack of support for accessing string characters by index.
|
164 | *
|
165 | * IE < 8 can't access characters by index and IE 8 can only access characters by index on
|
166 | * string literals.
|
167 | **/
|
168 | unindexedChars: boolean;
|
169 | }
|
170 |
|
171 | interface LoDashWrapperBase<T, TWrapper> {
|
172 | /**
|
173 | * Produces the toString result of the wrapped value.
|
174 | * @return Returns the string result.
|
175 | **/
|
176 | toString(): string;
|
177 |
|
178 | /**
|
179 | * Extracts the wrapped value.
|
180 | * @return The wrapped value.
|
181 | **/
|
182 | valueOf(): T;
|
183 |
|
184 | /**
|
185 | * @see valueOf
|
186 | **/
|
187 | value(): T;
|
188 | }
|
189 |
|
190 | interface LoDashWrapper<T> extends LoDashWrapperBase<T, LoDashWrapper<T>> {}
|
191 |
|
192 | interface LoDashObjectWrapper<T> extends LoDashWrapperBase<T, LoDashObjectWrapper<T>> {}
|
193 |
|
194 | interface LoDashArrayWrapper<T> extends LoDashWrapperBase<T[], LoDashArrayWrapper<T>> {
|
195 | concat(...items: T[]): LoDashArrayWrapper<T>;
|
196 | join(seperator?: string): LoDashWrapper<string>;
|
197 | pop(): LoDashWrapper<T>;
|
198 | push(...items: T[]): void;
|
199 | reverse(): LoDashArrayWrapper<T>;
|
200 | shift(): LoDashWrapper<T>;
|
201 | slice(start: number, end?: number): LoDashArrayWrapper<T>;
|
202 | sort(compareFn?: (a: T, b: T) => number): LoDashArrayWrapper<T>;
|
203 | splice(start: number): LoDashArrayWrapper<T>;
|
204 | splice(start: number, deleteCount: number, ...items: any[]): LoDashArrayWrapper<T>;
|
205 | unshift(...items: any[]): LoDashWrapper<number>;
|
206 | }
|
207 |
|
208 | //_.chain
|
209 | interface LoDashStatic {
|
210 | /**
|
211 | * Creates a lodash object that wraps the given value with explicit method chaining enabled.
|
212 | * @param value The value to wrap.
|
213 | * @return The wrapper object.
|
214 | **/
|
215 | chain(value: number): LoDashWrapper<number>;
|
216 | chain(value: string): LoDashWrapper<string>;
|
217 | chain(value: boolean): LoDashWrapper<boolean>;
|
218 | chain<T>(value: Array<T>): LoDashArrayWrapper<T>;
|
219 | chain<T extends {}>(value: T): LoDashObjectWrapper<T>;
|
220 | chain(value: any): LoDashWrapper<any>;
|
221 | }
|
222 |
|
223 | interface LoDashWrapperBase<T, TWrapper> {
|
224 | /**
|
225 | * Enables explicit method chaining on the wrapper object.
|
226 | * @see _.chain
|
227 | * @return The wrapper object.
|
228 | **/
|
229 | chain(): TWrapper;
|
230 | }
|
231 |
|
232 | //_.tap
|
233 | interface LoDashStatic {
|
234 | /**
|
235 | * Invokes interceptor with the value as the first argument and then returns value. The
|
236 | * purpose of this method is to "tap into" a method chain in order to perform operations on
|
237 | * intermediate results within the chain.
|
238 | * @param value The value to provide to interceptor
|
239 | * @param interceptor The function to invoke.
|
240 | * @return value
|
241 | **/
|
242 | tap<T>(
|
243 | value: T,
|
244 | interceptor: (value: T) => void): T;
|
245 | }
|
246 |
|
247 | interface LoDashWrapperBase<T, TWrapper> {
|
248 | /**
|
249 | * @see _.tap
|
250 | **/
|
251 | tap(interceptor: (value: T) => void): TWrapper;
|
252 | }
|
253 |
|
254 | /*********
|
255 | * Arrays *
|
256 | **********/
|
257 |
|
258 | //_.compact
|
259 | interface LoDashStatic {
|
260 | /**
|
261 | * Returns a copy of the array with all falsy values removed. In JavaScript, false, null, 0, "",
|
262 | * undefined and NaN are all falsy.
|
263 | * @param array Array to compact.
|
264 | * @return (Array) Returns a new array of filtered values.
|
265 | **/
|
266 | compact<T>(array: List<T>): T[];
|
267 | }
|
268 |
|
269 | interface LoDashArrayWrapper<T> {
|
270 | /**
|
271 | * @see _.compact
|
272 | **/
|
273 | compact<T>(): LoDashArrayWrapper<T>;
|
274 | }
|
275 |
|
276 | //_.difference
|
277 | interface LoDashStatic {
|
278 | /**
|
279 | * Creates an array excluding all values of the provided arrays using strict equality for comparisons
|
280 | * , i.e. ===.
|
281 | * @param array The array to process
|
282 | * @param others The arrays of values to exclude.
|
283 | * @return Returns a new array of filtered values.
|
284 | **/
|
285 | difference<T>(
|
286 | array: List<T>,
|
287 | ...others: List<T>[]): T[];
|
288 | }
|
289 |
|
290 | interface LoDashArrayWrapper<T> {
|
291 | /**
|
292 | * @see _.difference
|
293 | **/
|
294 | difference(
|
295 | ...others: List<T>[]): LoDashArrayWrapper<T>;
|
296 | }
|
297 |
|
298 | //_.findIndex
|
299 | interface LoDashStatic {
|
300 | /**
|
301 | * This method is like _.find except that it returns the index of the first element that passes
|
302 | * the callback check, instead of the element itself.
|
303 | * @param array The array to search.
|
304 | * @param {(Function|Object|string)} callback The function called per iteration. If a property name or object is provided it will be
|
305 | * used to create a ".pluck" or ".where" style callback, respectively.
|
306 | * @param thisArg The this binding of callback.
|
307 | * @return Returns the index of the found element, else -1.
|
308 | **/
|
309 | findIndex<T>(
|
310 | array: List<T>,
|
311 | callback: ListIterator<T, boolean>,
|
312 | thisArg?: any): number;
|
313 |
|
314 | /**
|
315 | * @see _.findIndex
|
316 | **/
|
317 | findIndex<T>(
|
318 | array: List<T>,
|
319 | pluckValue: string): number;
|
320 |
|
321 | /**
|
322 | * @see _.findIndex
|
323 | **/
|
324 | findIndex<W, T>(
|
325 | array: List<T>,
|
326 | whereDictionary: W): number;
|
327 | }
|
328 |
|
329 | //_.findLastIndex
|
330 | interface LoDashStatic {
|
331 | /**
|
332 | * This method is like _.findIndex except that it iterates over elements of a collection from right to left.
|
333 | * @param array The array to search.
|
334 | * @param {(Function|Object|string)} callback The function called per iteration. If a property name or object is provided it will be
|
335 | * used to create a ".pluck" or ".where" style callback, respectively.
|
336 | * @param thisArg The this binding of callback.
|
337 | * @return Returns the index of the found element, else -1.
|
338 | **/
|
339 | findLastIndex<T>(
|
340 | array: List<T>,
|
341 | callback: ListIterator<T, boolean>,
|
342 | thisArg?: any): number;
|
343 |
|
344 | /**
|
345 | * @see _.findLastIndex
|
346 | **/
|
347 | findLastIndex<T>(
|
348 | array: List<T>,
|
349 | pluckValue: string): number;
|
350 |
|
351 | /**
|
352 | * @see _.findLastIndex
|
353 | **/
|
354 | findLastIndex<T>(
|
355 | array: List<T>,
|
356 | whereDictionary: Dictionary<any>): number;
|
357 | }
|
358 |
|
359 | //_.first
|
360 | interface LoDashStatic {
|
361 | /**
|
362 | * Gets the first element or first n elements of an array. If a callback is provided
|
363 | * elements at the beginning of the array are returned as long as the callback returns
|
364 | * truey. The callback is bound to thisArg and invoked with three arguments; (value,
|
365 | * index, array).
|
366 | *
|
367 | * If a property name is provided for callback the created "_.pluck" style callback
|
368 | * will return the property value of the given element.
|
369 | *
|
370 | * If an object is provided for callback the created "_.where" style callback will return ]
|
371 | * true for elements that have the properties of the given object, else false.
|
372 | * @param array Retrieves the first element of this array.
|
373 | * @return Returns the first element of `array`.
|
374 | **/
|
375 | first<T>(array: List<T>): T;
|
376 |
|
377 | /**
|
378 | * @see _.first
|
379 | * @param n The number of elements to return.
|
380 | **/
|
381 | first<T>(
|
382 | array: List<T>,
|
383 | n: number): T[];
|
384 |
|
385 | /**
|
386 | * @see _.first
|
387 | * @param callback The function called per element.
|
388 | * @param [thisArg] The this binding of callback.
|
389 | **/
|
390 | first<T>(
|
391 | array: List<T>,
|
392 | callback: ListIterator<T, boolean>,
|
393 | thisArg?: any): T[];
|
394 |
|
395 | /**
|
396 | * @see _.first
|
397 | * @param pluckValue "_.pluck" style callback value
|
398 | **/
|
399 | first<T>(
|
400 | array: List<T>,
|
401 | pluckValue: string): T[];
|
402 |
|
403 | /**
|
404 | * @see _.first
|
405 | * @param whereValue "_.where" style callback value
|
406 | **/
|
407 | first<W, T>(
|
408 | array: List<T>,
|
409 | whereValue: W): T[];
|
410 |
|
411 | /**
|
412 | * @see _.first
|
413 | **/
|
414 | head<T>(array: List<T>): T;
|
415 |
|
416 | /**
|
417 | * @see _.first
|
418 | **/
|
419 | head<T>(
|
420 | array: List<T>,
|
421 | n: number): T[];
|
422 |
|
423 | /**
|
424 | * @see _.first
|
425 | **/
|
426 | head<T>(
|
427 | array: List<T>,
|
428 | callback: ListIterator<T, boolean>,
|
429 | thisArg?: any): T[];
|
430 |
|
431 | /**
|
432 | * @see _.first
|
433 | **/
|
434 | head<T>(
|
435 | array: List<T>,
|
436 | pluckValue: string): T[];
|
437 |
|
438 | /**
|
439 | * @see _.first
|
440 | **/
|
441 | head<W, T>(
|
442 | array: List<T>,
|
443 | whereValue: W): T[];
|
444 |
|
445 | /**
|
446 | * @see _.first
|
447 | **/
|
448 | take<T>(array: List<T>): T;
|
449 |
|
450 | /**
|
451 | * @see _.first
|
452 | **/
|
453 | take<T>(
|
454 | array: List<T>,
|
455 | n: number): T[];
|
456 |
|
457 | /**
|
458 | * @see _.first
|
459 | **/
|
460 | take<T>(
|
461 | array: List<T>,
|
462 | callback: ListIterator<T, boolean>,
|
463 | thisArg?: any): T[];
|
464 |
|
465 | /**
|
466 | * @see _.first
|
467 | **/
|
468 | take<T>(
|
469 | array: List<T>,
|
470 | pluckValue: string): T[];
|
471 |
|
472 | /**
|
473 | * @see _.first
|
474 | **/
|
475 | take<W, T>(
|
476 | array: List<T>,
|
477 | whereValue: W): T[];
|
478 | }
|
479 |
|
480 | //_.flatten
|
481 | interface LoDashStatic {
|
482 | /**
|
483 | * Flattens a nested array (the nesting can be to any depth). If isShallow is truey, the
|
484 | * array will only be flattened a single level. If a callback is provided each element of
|
485 | * the array is passed through the callback before flattening. The callback is bound to
|
486 | * thisArg and invoked with three arguments; (value, index, array).
|
487 | *
|
488 | * If a property name is provided for callback the created "_.pluck" style callback will
|
489 | * return the property value of the given element.
|
490 | *
|
491 | * If an object is provided for callback the created "_.where" style callback will return
|
492 | * true for elements that have the properties of the given object, else false.
|
493 | * @param array The array to flatten.
|
494 | * @param shallow If true then only flatten one level, optional, default = false.
|
495 | * @return `array` flattened.
|
496 | **/
|
497 | flatten<T>(array: List<any>, isShallow?: boolean): T[];
|
498 |
|
499 | flatten<T>(
|
500 | array: List<any>,
|
501 | isShallow: boolean,
|
502 | callback: ListIterator<any, T>,
|
503 | thisArg?: any): T[];
|
504 |
|
505 | flatten<T>(
|
506 | array: List<any>,
|
507 | callback: ListIterator<any, T>,
|
508 | thisArg?: any): T[];
|
509 |
|
510 | flatten<W, T>(
|
511 | array: List<any>,
|
512 | isShallow: boolean,
|
513 | whereValue: W): T[];
|
514 |
|
515 | flatten<W, T>(
|
516 | array: List<any>,
|
517 | whereValue: W): T[];
|
518 |
|
519 | flatten<T>(
|
520 | array: List<any>,
|
521 | isShallow: boolean,
|
522 | pluckValue: string): T[];
|
523 |
|
524 | flatten<T>(
|
525 | array: List<any>,
|
526 | pluckValue: string): T[];
|
527 | }
|
528 |
|
529 | interface LoDashArrayWrapper<T> {
|
530 | /**
|
531 | * @see _.flatten
|
532 | **/
|
533 | flatten<Flat>(isShallow?: boolean): LoDashArrayWrapper<Flat>;
|
534 |
|
535 | flatten<Flat>(
|
536 | isShallow: boolean,
|
537 | callback: ListIterator<T, Flat>,
|
538 | thisArg?: any): LoDashArrayWrapper<Flat>;
|
539 |
|
540 | flatten<Flat>(
|
541 | callback: ListIterator<T, Flat>,
|
542 | thisArg?: any): LoDashArrayWrapper<Flat>;
|
543 |
|
544 | flatten<Flat>(
|
545 | isShallow: boolean,
|
546 | pluckValue: string): LoDashArrayWrapper<Flat>;
|
547 |
|
548 | flatten<Flat>(
|
549 | pluckValue: string): LoDashArrayWrapper<Flat>;
|
550 |
|
551 | flatten<Flat, W>(
|
552 | isShallow: boolean,
|
553 | whereValue: W): LoDashArrayWrapper<Flat>;
|
554 |
|
555 | flatten<Flat, W>(
|
556 | whereValue: W): LoDashArrayWrapper<Flat>;
|
557 | }
|
558 |
|
559 | //_.indexOf
|
560 | interface LoDashStatic {
|
561 | /**
|
562 | * Gets the index at which the first occurrence of value is found using strict equality
|
563 | * for comparisons, i.e. ===. If the array is already sorted providing true for fromIndex
|
564 | * will run a faster binary search.
|
565 | * @param array The array to search.
|
566 | * @param value The value to search for.
|
567 | * @param fromIndex The index to search from.
|
568 | * @return The index of `value` within `array`.
|
569 | **/
|
570 | indexOf<T>(
|
571 | array: List<T>,
|
572 | value: T): number;
|
573 |
|
574 | /**
|
575 | * @see _.indexOf
|
576 | * @param fromIndex The index to search from
|
577 | **/
|
578 | indexOf<T>(
|
579 | array: List<T>,
|
580 | value: T,
|
581 | fromIndex: number): number;
|
582 |
|
583 | /**
|
584 | * @see _.indexOf
|
585 | * @param isSorted True to perform a binary search on a sorted array.
|
586 | **/
|
587 | indexOf<T>(
|
588 | array: List<T>,
|
589 | value: T,
|
590 | isSorted: boolean): number;
|
591 | }
|
592 |
|
593 | //_.initial
|
594 | interface LoDashStatic {
|
595 | /**
|
596 | * Gets all but the last element or last n elements of an array. If a callback is provided
|
597 | * elements at the end of the array are excluded from the result as long as the callback
|
598 | * returns truey. The callback is bound to thisArg and invoked with three arguments;
|
599 | * (value, index, array).
|
600 | *
|
601 | * If a property name is provided for callback the created "_.pluck" style callback will
|
602 | * return the property value of the given element.
|
603 | *
|
604 | * If an object is provided for callback the created "_.where" style callback will return
|
605 | * true for elements that have the properties of the given object, else false.
|
606 | * @param array The array to query.
|
607 | * @param n Leaves this many elements behind, optional.
|
608 | * @return Returns everything but the last `n` elements of `array`.
|
609 | **/
|
610 | initial<T>(
|
611 | array: List<T>): T[];
|
612 |
|
613 | /**
|
614 | * @see _.initial
|
615 | * @param n The number of elements to exclude.
|
616 | **/
|
617 | initial<T>(
|
618 | array: List<T>,
|
619 | n: number): T[];
|
620 |
|
621 | /**
|
622 | * @see _.initial
|
623 | * @param callback The function called per element
|
624 | **/
|
625 | initial<T>(
|
626 | array: List<T>,
|
627 | callback: ListIterator<T, boolean>): T[];
|
628 |
|
629 | /**
|
630 | * @see _.initial
|
631 | * @param pluckValue _.pluck style callback
|
632 | **/
|
633 | initial<T>(
|
634 | array: List<T>,
|
635 | pluckValue: string): T[];
|
636 |
|
637 | /**
|
638 | * @see _.initial
|
639 | * @param whereValue _.where style callback
|
640 | **/
|
641 | initial<W, T>(
|
642 | array: List<T>,
|
643 | whereValue: W): T[];
|
644 | }
|
645 |
|
646 | //_.intersection
|
647 | interface LoDashStatic {
|
648 | /**
|
649 | * Creates an array of unique values present in all provided arrays using strict
|
650 | * equality for comparisons, i.e. ===.
|
651 | * @param arrays The arrays to inspect.
|
652 | * @return Returns an array of composite values.
|
653 | **/
|
654 | intersection<T>(...arrays: List<T>[]): T[];
|
655 | }
|
656 |
|
657 | //_.last
|
658 | interface LoDashStatic {
|
659 | /**
|
660 | * Gets the last element or last n elements of an array. If a callback is provided
|
661 | * elements at the end of the array are returned as long as the callback returns truey.
|
662 | * The callback is bound to thisArg and invoked with three arguments; (value, index, array).
|
663 | *
|
664 | * If a property name is provided for callback the created "_.pluck" style callback will
|
665 | * return the property value of the given element.
|
666 | *
|
667 | * If an object is provided for callback the created "_.where" style callback will return
|
668 | * true for elements that have the properties of the given object, else false.
|
669 | * @param array The array to query.
|
670 | * @return Returns the last element(s) of array.
|
671 | **/
|
672 | last<T>(array: List<T>): T;
|
673 |
|
674 | /**
|
675 | * @see _.last
|
676 | * @param n The number of elements to return
|
677 | **/
|
678 | last<T>(
|
679 | array: List<T>,
|
680 | n: number): T[];
|
681 |
|
682 | /**
|
683 | * @see _.last
|
684 | * @param callback The function called per element
|
685 | **/
|
686 | last<T>(
|
687 | array: List<T>,
|
688 | callback: ListIterator<T, boolean>,
|
689 | thisArg?: any): T[];
|
690 |
|
691 | /**
|
692 | * @see _.last
|
693 | * @param pluckValue _.pluck style callback
|
694 | **/
|
695 | last<T>(
|
696 | array: List<T>,
|
697 | pluckValue: string): T[];
|
698 |
|
699 | /**
|
700 | * @see _.last
|
701 | * @param whereValue _.where style callback
|
702 | **/
|
703 | last<W, T>(
|
704 | array: List<T>,
|
705 | whereValue: W): T[];
|
706 | }
|
707 |
|
708 | //_.lastIndexOf
|
709 | interface LoDashStatic {
|
710 | /**
|
711 | * Gets the index at which the last occurrence of value is found using strict equality
|
712 | * for comparisons, i.e. ===. If fromIndex is negative, it is used as the offset from the
|
713 | * end of the collection.
|
714 | * @param array The array to search.
|
715 | * @param value The value to search for.
|
716 | * @param fromIndex The index to search from.
|
717 | * @return The index of the matched value or -1.
|
718 | **/
|
719 | lastIndexOf<T>(
|
720 | array: List<T>,
|
721 | value: T,
|
722 | fromIndex?: number): number;
|
723 | }
|
724 |
|
725 | //_.pull
|
726 | interface LoDashStatic {
|
727 | /**
|
728 | * Removes all provided values from the given array using strict equality for comparisons,
|
729 | * i.e. ===.
|
730 | * @param array The array to modify.
|
731 | * @param values The values to remove.
|
732 | * @return array.
|
733 | **/
|
734 | pull(
|
735 | array: List<any>,
|
736 | ...values: any[]): any[];
|
737 | }
|
738 |
|
739 | //_.range
|
740 | interface LoDashStatic {
|
741 | /**
|
742 | * Creates an array of numbers (positive and/or negative) progressing from start up
|
743 | * to but not including end. If start is less than stop a zero-length range is created
|
744 | * unless a negative step is specified.
|
745 | * @param start The start of the range.
|
746 | * @param end The end of the range.
|
747 | * @param step The value to increment or decrement by.
|
748 | * @return Returns a new range array.
|
749 | **/
|
750 |
|
751 | range(
|
752 | start: number,
|
753 | stop: number,
|
754 | step?: number): number[];
|
755 |
|
756 | /**
|
757 | * @see _.range
|
758 | * @param end The end of the range.
|
759 | * @return Returns a new range array.
|
760 | * @note If start is not specified the implementation will never pull the step (step = arguments[2] || 0)
|
761 | **/
|
762 | range(stop: number): number[];
|
763 | }
|
764 |
|
765 | //_.remove
|
766 | interface LoDashStatic {
|
767 | /**
|
768 | * Removes all elements from an array that the callback returns truey for and returns
|
769 | * an array of removed elements. The callback is bound to thisArg and invoked with three
|
770 | * arguments; (value, index, array).
|
771 | *
|
772 | * If a property name is provided for callback the created "_.pluck" style callback will
|
773 | * return the property value of the given element.
|
774 | *
|
775 | * If an object is provided for callback the created "_.where" style callback will return
|
776 | * true for elements that have the properties of the given object, else false.
|
777 | * @param array The array to modify.
|
778 | * @param callback The function called per iteration.
|
779 | * @param thisArg The this binding of callback.
|
780 | * @return A new array of removed elements.
|
781 | **/
|
782 | remove(
|
783 | array: List<any>,
|
784 | callback?: ListIterator<any, boolean>,
|
785 | thisArg?: any): any[];
|
786 |
|
787 | /**
|
788 | * @see _.remove
|
789 | * @param pluckValue _.pluck style callback
|
790 | **/
|
791 | remove(
|
792 | array: List<any>,
|
793 | pluckValue?: string): any[];
|
794 |
|
795 | /**
|
796 | * @see _.remove
|
797 | * @param whereValue _.where style callback
|
798 | **/
|
799 | remove(
|
800 | array: List<any>,
|
801 | wherealue?: Dictionary<any>): any[];
|
802 | }
|
803 |
|
804 | //_.rest
|
805 | interface LoDashStatic {
|
806 | /**
|
807 | * The opposite of _.initial this method gets all but the first element or first n elements of
|
808 | * an array. If a callback function is provided elements at the beginning of the array are excluded
|
809 | * from the result as long as the callback returns truey. The callback is bound to thisArg and
|
810 | * invoked with three arguments; (value, index, array).
|
811 | *
|
812 | * If a property name is provided for callback the created "_.pluck" style callback will return
|
813 | * the property value of the given element.
|
814 | *
|
815 | * If an object is provided for callback the created "_.where" style callback will return true
|
816 | * for elements that have the properties of the given object, else false.
|
817 | * @param array The array to query.
|
818 | * @param {(Function|Object|number|string)} [callback=1] The function called per element or the number
|
819 | * of elements to exclude. If a property name or object is provided it will be used to create a
|
820 | * ".pluck" or ".where" style callback, respectively.
|
821 | * @param {*} [thisArg] The this binding of callback.
|
822 | * @return Returns a slice of array.
|
823 | **/
|
824 | rest<T>(array: List<T>): T[];
|
825 |
|
826 | /**
|
827 | * @see _.rest
|
828 | **/
|
829 | rest<T>(
|
830 | array: List<T>,
|
831 | callback: ListIterator<T, boolean>,
|
832 | thisArg?: any): T[];
|
833 |
|
834 | /**
|
835 | * @see _.rest
|
836 | **/
|
837 | rest<T>(
|
838 | array: List<T>,
|
839 | n: number): T[];
|
840 |
|
841 | /**
|
842 | * @see _.rest
|
843 | **/
|
844 | rest<T>(
|
845 | array: List<T>,
|
846 | pluckValue: string): T[];
|
847 |
|
848 | /**
|
849 | * @see _.rest
|
850 | **/
|
851 | rest<W, T>(
|
852 | array: List<T>,
|
853 | whereValue: W): T[];
|
854 |
|
855 | /**
|
856 | * @see _.rest
|
857 | **/
|
858 | drop<T>(array: List<T>): T[];
|
859 |
|
860 | /**
|
861 | * @see _.rest
|
862 | **/
|
863 | drop<T>(
|
864 | array: List<T>,
|
865 | callback: ListIterator<T, boolean>,
|
866 | thisArg?: any): T[];
|
867 |
|
868 | /**
|
869 | * @see _.rest
|
870 | **/
|
871 | drop<T>(
|
872 | array: List<T>,
|
873 | n: number): T[];
|
874 |
|
875 | /**
|
876 | * @see _.rest
|
877 | **/
|
878 | drop<T>(
|
879 | array: List<T>,
|
880 | pluckValue: string): T[];
|
881 |
|
882 | /**
|
883 | * @see _.rest
|
884 | **/
|
885 | drop<W, T>(
|
886 | array: List<T>,
|
887 | whereValue: W): T[];
|
888 |
|
889 | /**
|
890 | * @see _.rest
|
891 | **/
|
892 | tail<T>(array: List<T>): T[];
|
893 |
|
894 | /**
|
895 | * @see _.rest
|
896 | **/
|
897 | tail<T>(
|
898 | array: List<T>,
|
899 | callback: ListIterator<T, boolean>,
|
900 | thisArg?: any): T[];
|
901 |
|
902 | /**
|
903 | * @see _.rest
|
904 | **/
|
905 | tail<T>(
|
906 | array: List<T>,
|
907 | n: number): T[];
|
908 |
|
909 | /**
|
910 | * @see _.rest
|
911 | **/
|
912 | tail<T>(
|
913 | array: List<T>,
|
914 | pluckValue: string): T[];
|
915 |
|
916 | /**
|
917 | * @see _.rest
|
918 | **/
|
919 | tail<W, T>(
|
920 | array: List<T>,
|
921 | whereValue: W): T[];
|
922 | }
|
923 |
|
924 | //_.sortedIndex
|
925 | interface LoDashStatic {
|
926 | /**
|
927 | * Uses a binary search to determine the smallest index at which a value should be inserted
|
928 | * into a given sorted array in order to maintain the sort order of the array. If a callback
|
929 | * is provided it will be executed for value and each element of array to compute their sort
|
930 | * ranking. The callback is bound to thisArg and invoked with one argument; (value).
|
931 | *
|
932 | * If a property name is provided for callback the created "_.pluck" style callback will
|
933 | * return the property value of the given element.
|
934 | *
|
935 | * If an object is provided for callback the created "_.where" style callback will return
|
936 | * true for elements that have the properties of the given object, else false.
|
937 | * @param array The sorted list.
|
938 | * @param value The value to determine its index within `list`.
|
939 | * @param callback Iterator to compute the sort ranking of each value, optional.
|
940 | * @return The index at which value should be inserted into array.
|
941 | **/
|
942 | sortedIndex<T, TSort>(
|
943 | array: List<T>,
|
944 | value: T,
|
945 | callback?: (x: T) => TSort,
|
946 | thisArg?: any): number;
|
947 |
|
948 | /**
|
949 | * @see _.sortedIndex
|
950 | * @param pluckValue the _.pluck style callback
|
951 | **/
|
952 | sortedIndex<T>(
|
953 | array: List<T>,
|
954 | value: T,
|
955 | pluckValue: string): number;
|
956 |
|
957 | /**
|
958 | * @see _.sortedIndex
|
959 | * @param pluckValue the _.where style callback
|
960 | **/
|
961 | sortedIndex<W, T>(
|
962 | array: List<T>,
|
963 | value: T,
|
964 | whereValue: W): number;
|
965 | }
|
966 |
|
967 | //_.union
|
968 | interface LoDashStatic {
|
969 | /**
|
970 | * Creates an array of unique values, in order, of the provided arrays using strict
|
971 | * equality for comparisons, i.e. ===.
|
972 | * @param arrays The arrays to inspect.
|
973 | * @return Returns an array of composite values.
|
974 | **/
|
975 | union<T>(...arrays: List<T>[]): T[];
|
976 | }
|
977 |
|
978 | //_.uniq
|
979 | interface LoDashStatic {
|
980 | /**
|
981 | * Creates a duplicate-value-free version of an array using strict equality for comparisons,
|
982 | * i.e. ===. If the array is sorted, providing true for isSorted will use a faster algorithm.
|
983 | * If a callback is provided each element of array is passed through the callback before
|
984 | * uniqueness is computed. The callback is bound to thisArg and invoked with three arguments;
|
985 | * (value, index, array).
|
986 | *
|
987 | * If a property name is provided for callback the created "_.pluck" style callback will
|
988 | * return the property value of the given element.
|
989 | *
|
990 | * If an object is provided for callback the created "_.where" style callback will return
|
991 | * true for elements that have the properties of the given object, else false.
|
992 | * @param array Array to remove duplicates from.
|
993 | * @param isSorted True if `array` is already sorted, optiona, default = false.
|
994 | * @param iterator Transform the elements of `array` before comparisons for uniqueness.
|
995 | * @param context 'this' object in `iterator`, optional.
|
996 | * @return Copy of `array` where all elements are unique.
|
997 | **/
|
998 | uniq<T, TSort>(array: List<T>, isSorted?: boolean): T[];
|
999 |
|
1000 | uniq<T, TSort>(
|
1001 | array: List<T>,
|
1002 | isSorted: boolean,
|
1003 | callback: ListIterator<T, TSort>,
|
1004 | thisArg?: any): T[];
|
1005 |
|
1006 | /**
|
1007 | * @see _.uniq
|
1008 | **/
|
1009 | uniq<T, TSort>(
|
1010 | array: List<T>,
|
1011 | callback: ListIterator<T, TSort>,
|
1012 | thisArg?: any): T[];
|
1013 |
|
1014 | /**
|
1015 | * @see _.uniq
|
1016 | * @param pluckValue _.pluck style callback
|
1017 | **/
|
1018 | uniq<T>(
|
1019 | array: List<T>,
|
1020 | isSorted: boolean,
|
1021 | pluckValue: string): T[];
|
1022 |
|
1023 | uniq<T>(
|
1024 | array: List<T>,
|
1025 | pluckValue: string): T[];
|
1026 |
|
1027 | /**
|
1028 | * @see _.uniq
|
1029 | * @param whereValue _.where style callback
|
1030 | **/
|
1031 | uniq<W, T>(
|
1032 | array: List<T>,
|
1033 | isSorted: boolean,
|
1034 | whereValue: W): T[];
|
1035 |
|
1036 | uniq<W, T>(
|
1037 | array: List<T>,
|
1038 | whereValue: W): T[];
|
1039 |
|
1040 | /**
|
1041 | * @see _.uniq
|
1042 | **/
|
1043 | unique<T>(array: List<T>, isSorted?: boolean): T[];
|
1044 |
|
1045 | unique<T, TSort>(
|
1046 | array: List<T>,
|
1047 | callback: ListIterator<T, TSort>,
|
1048 | thisArg?: any): T[];
|
1049 |
|
1050 | /**
|
1051 | * @see _.uniq
|
1052 | **/
|
1053 | unique<T, TSort>(
|
1054 | array: List<T>,
|
1055 | isSorted: boolean,
|
1056 | callback: ListIterator<T, TSort>,
|
1057 | thisArg?: any): T[];
|
1058 |
|
1059 | /**
|
1060 | * @see _.uniq
|
1061 | * @param pluckValue _.pluck style callback
|
1062 | **/
|
1063 | unique<T>(
|
1064 | array: List<T>,
|
1065 | isSorted: boolean,
|
1066 | pluckValue: string): T[];
|
1067 |
|
1068 | unique<T>(
|
1069 | array: List<T>,
|
1070 | pluckValue: string): T[];
|
1071 |
|
1072 | /**
|
1073 | * @see _.uniq
|
1074 | * @param whereValue _.where style callback
|
1075 | **/
|
1076 | unique<W, T>(
|
1077 | array: List<T>,
|
1078 | whereValue?: W): T[];
|
1079 |
|
1080 | unique<W, T>(
|
1081 | array: List<T>,
|
1082 | isSorted: boolean,
|
1083 | whereValue?: W): T[];
|
1084 | }
|
1085 |
|
1086 | //_.without
|
1087 | interface LoDashStatic {
|
1088 | /**
|
1089 | * Creates an array excluding all provided values using strict equality for comparisons, i.e. ===.
|
1090 | * @param array The array to filter.
|
1091 | * @param values The value(s) to exclude.
|
1092 | * @return A new array of filtered values.
|
1093 | **/
|
1094 | without<T>(
|
1095 | array: List<T>,
|
1096 | ...values: T[]): T[];
|
1097 | }
|
1098 |
|
1099 | //_.zip
|
1100 | interface LoDashStatic {
|
1101 | /**
|
1102 | * Creates an array of grouped elements, the first of which contains the first
|
1103 | * elements of the given arrays, the second of which contains the second elements
|
1104 | * of the given arrays, and so on.
|
1105 | * @param arrays Arrays to process.
|
1106 | * @return A new array of grouped elements.
|
1107 | **/
|
1108 | zip(...arrays: any[][]): any[][];
|
1109 |
|
1110 | /**
|
1111 | * @see _.zip
|
1112 | **/
|
1113 | zip(...arrays: any[]): any[];
|
1114 |
|
1115 | /**
|
1116 | * @see _.zip
|
1117 | **/
|
1118 | unzip(...arrays: any[][]): any[][];
|
1119 |
|
1120 | /**
|
1121 | * @see _.zip
|
1122 | **/
|
1123 | unzip(...arrays: any[]): any[];
|
1124 | }
|
1125 |
|
1126 | //_.zipObject
|
1127 | interface LoDashStatic {
|
1128 | /**
|
1129 | * Creates an object composed from arrays of keys and values. Provide either a single
|
1130 | * two dimensional array, i.e. [[key1, value1], [key2, value2]] or two arrays, one of
|
1131 | * keys and one of corresponding values.
|
1132 | * @param keys The array of keys.
|
1133 | * @param values The array of values.
|
1134 | * @return An object composed of the given keys and corresponding values.
|
1135 | **/
|
1136 | zipObject<TResult extends {}>(
|
1137 | keys: List<string>,
|
1138 | values: List<any>): TResult;
|
1139 |
|
1140 | /**
|
1141 | * @see _.object
|
1142 | **/
|
1143 | object<TResult extends {}>(
|
1144 | keys: List<string>,
|
1145 | values: List<any>): TResult;
|
1146 | }
|
1147 |
|
1148 | /* *************
|
1149 | * Collections *
|
1150 | ************* */
|
1151 |
|
1152 | //_.at
|
1153 | interface LoDashStatic {
|
1154 | /**
|
1155 | * Creates an array of elements from the specified indexes, or keys, of the collection.
|
1156 | * Indexes may be specified as individual arguments or as arrays of indexes.
|
1157 | * @param collection The collection to iterate over.
|
1158 | * @param indexes The indexes of collection to retrieve, specified as individual indexes or
|
1159 | * arrays of indexes.
|
1160 | * @return A new array of elements corresponding to the provided indexes.
|
1161 | **/
|
1162 | at<T>(
|
1163 | collection: Collection<T>,
|
1164 | indexes: number[]): T[];
|
1165 |
|
1166 | /**
|
1167 | * @see _.at
|
1168 | **/
|
1169 | at<T>(
|
1170 | collection: Collection<T>,
|
1171 | ...indexes: number[]): T[];
|
1172 | }
|
1173 |
|
1174 | //_.contains
|
1175 | interface LoDashStatic {
|
1176 | /**
|
1177 | * Checks if a given value is present in a collection using strict equality for comparisons,
|
1178 | * i.e. ===. If fromIndex is negative, it is used as the offset from the end of the collection.
|
1179 | * @param collection The collection to iterate over.
|
1180 | * @param target The value to check for.
|
1181 | * @param fromIndex The index to search from.
|
1182 | * @return True if the target element is found, else false.
|
1183 | **/
|
1184 | contains<T>(
|
1185 | collection: Collection<T>,
|
1186 | target: T,
|
1187 | fromIndex?: number): boolean;
|
1188 |
|
1189 | /**
|
1190 | * @see _.contains
|
1191 | * @param dictionary The dictionary to iterate over.
|
1192 | * @param key The key in the dictionary to search for.
|
1193 | **/
|
1194 | contains<T>(
|
1195 | dictionary: Dictionary<T>,
|
1196 | key: string,
|
1197 | fromIndex?: number): boolean;
|
1198 |
|
1199 | /**
|
1200 | * @see _.contains
|
1201 | * @param searchString the string to search
|
1202 | * @param targetString the string to search for
|
1203 | **/
|
1204 | contains(
|
1205 | searchString: string,
|
1206 | targetString: string,
|
1207 | fromIndex?: number): boolean;
|
1208 |
|
1209 | /**
|
1210 | * @see _.contains
|
1211 | **/
|
1212 | include<T>(
|
1213 | collection: Collection<T>,
|
1214 | target: T,
|
1215 | fromIndex?: number): boolean;
|
1216 |
|
1217 | /**
|
1218 | * @see _.contains
|
1219 | **/
|
1220 | include<T>(
|
1221 | dictionary: Dictionary<T>,
|
1222 | key: string,
|
1223 | fromIndex?: number): boolean;
|
1224 |
|
1225 | /**
|
1226 | * @see _.contains
|
1227 | **/
|
1228 | include(
|
1229 | searchString: string,
|
1230 | targetString: string,
|
1231 | fromIndex?: number): boolean;
|
1232 | }
|
1233 |
|
1234 | //_.countBy
|
1235 | interface LoDashStatic {
|
1236 | /**
|
1237 | * Creates an object composed of keys generated from the results of running each element
|
1238 | * of collection through the callback. The corresponding value of each key is the number
|
1239 | * of times the key was returned by the callback. The callback is bound to thisArg and
|
1240 | * invoked with three arguments; (value, index|key, collection).
|
1241 | *
|
1242 | * If a property name is provided for callback the created "_.pluck" style callback will
|
1243 | * return the property value of the given element.
|
1244 | *
|
1245 | * If an object is provided for callback the created "_.where" style callback will return
|
1246 | * true for elements that have the properties of the given object, else false.
|
1247 | * @param collection The collection to iterate over.
|
1248 | * @param callback The function called per iteration.
|
1249 | * @param thisArg The this binding of callback.
|
1250 | * @return Returns the composed aggregate object.
|
1251 | **/
|
1252 | countBy<T>(
|
1253 | collection: Collection<T>,
|
1254 | callback?: ListIterator<T, any>,
|
1255 | thisArg?: any): Dictionary<number>;
|
1256 |
|
1257 | /**
|
1258 | * @see _.countBy
|
1259 | * @param callback Function name
|
1260 | **/
|
1261 | countBy<T>(
|
1262 | collection: Collection<T>,
|
1263 | callback: string,
|
1264 | thisArg?: any): Dictionary<number>;
|
1265 | }
|
1266 |
|
1267 | interface LoDashArrayWrapper<T> {
|
1268 | /**
|
1269 | * @see _.countBy
|
1270 | **/
|
1271 | countBy<T>(
|
1272 | callback?: ListIterator<T, any>,
|
1273 | thisArg?: any): LoDashObjectWrapper<Dictionary<number>>;
|
1274 |
|
1275 | /**
|
1276 | * @see _.countBy
|
1277 | * @param callback Function name
|
1278 | **/
|
1279 | countBy<T>(
|
1280 | callback: string,
|
1281 | thisArg?: any): LoDashObjectWrapper<Dictionary<number>>;
|
1282 | }
|
1283 |
|
1284 | //_.every
|
1285 | interface LoDashStatic {
|
1286 | /**
|
1287 | * Checks if the given callback returns truey value for all elements of a collection.
|
1288 | * The callback is bound to thisArg and invoked with three arguments; (value, index|key,
|
1289 | * collection).
|
1290 | *
|
1291 | * If a property name is provided for callback the created "_.pluck" style callback will
|
1292 | * return the property value of the given element.
|
1293 | *
|
1294 | * If an object is provided for callback the created "_.where" style callback will return
|
1295 | * true for elements that have the properties of the given object, else false.
|
1296 | * @param collection The collection to iterate over.
|
1297 | * @param callback The function called per iteration.
|
1298 | * @param thisArg The this binding of callback.
|
1299 | * @return True if all elements passed the callback check, else false.
|
1300 | **/
|
1301 | every<T>(
|
1302 | collection: Collection<T>,
|
1303 | callback?: ListIterator<T, boolean>,
|
1304 | thisArg?: any): boolean;
|
1305 |
|
1306 | /**
|
1307 | * @see _.every
|
1308 | * @param pluckValue _.pluck style callback
|
1309 | **/
|
1310 | every<T>(
|
1311 | collection: Collection<T>,
|
1312 | pluckValue: string): boolean;
|
1313 |
|
1314 | /**
|
1315 | * @see _.every
|
1316 | * @param whereValue _.where style callback
|
1317 | **/
|
1318 | every<W, T>(
|
1319 | collection: Collection<T>,
|
1320 | whereValue: W): boolean;
|
1321 |
|
1322 | /**
|
1323 | * @see _.every
|
1324 | **/
|
1325 | all<T>(
|
1326 | collection: Collection<T>,
|
1327 | callback?: ListIterator<T, boolean>,
|
1328 | thisArg?: any): boolean;
|
1329 |
|
1330 | /**
|
1331 | * @see _.every
|
1332 | * @param pluckValue _.pluck style callback
|
1333 | **/
|
1334 | all<T>(
|
1335 | collection: Collection<T>,
|
1336 | pluckValue: string): boolean;
|
1337 |
|
1338 | /**
|
1339 | * @see _.every
|
1340 | * @param whereValue _.where style callback
|
1341 | **/
|
1342 | all<W, T>(
|
1343 | collection: Collection<T>,
|
1344 | whereValue: W): boolean;
|
1345 | }
|
1346 |
|
1347 | //_.filter
|
1348 | interface LoDashStatic {
|
1349 | /**
|
1350 | * Iterates over elements of a collection, returning an array of all elements the
|
1351 | * callback returns truey for. The callback is bound to thisArg and invoked with three
|
1352 | * arguments; (value, index|key, collection).
|
1353 | *
|
1354 | * If a property name is provided for callback the created "_.pluck" style callback will
|
1355 | * return the property value of the given element.
|
1356 | *
|
1357 | * If an object is provided for callback the created "_.where" style callback will return
|
1358 | * true for elements that have the properties of the given object, else false.
|
1359 | * @param collection The collection to iterate over.
|
1360 | * @param callback The function called per iteration.
|
1361 | * @param context The this binding of callback.
|
1362 | * @return Returns a new array of elements that passed the callback check.
|
1363 | **/
|
1364 | filter<T>(
|
1365 | collection: Collection<T>,
|
1366 | callback: ListIterator<T, boolean>,
|
1367 | thisArg?: any): T[];
|
1368 |
|
1369 | /**
|
1370 | * @see _.filter
|
1371 | * @param pluckValue _.pluck style callback
|
1372 | **/
|
1373 | filter<T>(
|
1374 | collection: Collection<T>,
|
1375 | pluckValue: string): T[];
|
1376 |
|
1377 | /**
|
1378 | * @see _.filter
|
1379 | * @param pluckValue _.pluck style callback
|
1380 | **/
|
1381 | filter<W, T>(
|
1382 | collection: Collection<T>,
|
1383 | whereValue: W): T[];
|
1384 |
|
1385 | /**
|
1386 | * @see _.filter
|
1387 | **/
|
1388 | select<T>(
|
1389 | collection: Collection<T>,
|
1390 | callback: ListIterator<T, boolean>,
|
1391 | thisArg?: any): T[];
|
1392 |
|
1393 | /**
|
1394 | * @see _.filter
|
1395 | * @param pluckValue _.pluck style callback
|
1396 | **/
|
1397 | select<T>(
|
1398 | collection: Collection<T>,
|
1399 | pluckValue: string): T[];
|
1400 |
|
1401 | /**
|
1402 | * @see _.filter
|
1403 | * @param pluckValue _.pluck style callback
|
1404 | **/
|
1405 | select<W, T>(
|
1406 | collection: Collection<T>,
|
1407 | whereValue: W): T[];
|
1408 | }
|
1409 |
|
1410 | interface LoDashArrayWrapper<T> {
|
1411 | /**
|
1412 | * @see _.filter
|
1413 | **/
|
1414 | filter<T>(
|
1415 | callback: ListIterator<T, boolean>,
|
1416 | thisArg?: any): LoDashArrayWrapper<T>;
|
1417 |
|
1418 | /**
|
1419 | * @see _.filter
|
1420 | * @param pluckValue _.pluck style callback
|
1421 | **/
|
1422 | filter<T>(
|
1423 | pluckValue: string): LoDashArrayWrapper<T>;
|
1424 |
|
1425 | /**
|
1426 | * @see _.filter
|
1427 | * @param pluckValue _.pluck style callback
|
1428 | **/
|
1429 | filter<W, T>(
|
1430 | whereValue: W): LoDashArrayWrapper<T>;
|
1431 |
|
1432 | /**
|
1433 | * @see _.filter
|
1434 | **/
|
1435 | select<T>(
|
1436 | callback: ListIterator<T, boolean>,
|
1437 | thisArg?: any): LoDashArrayWrapper<T>;
|
1438 |
|
1439 | /**
|
1440 | * @see _.filter
|
1441 | * @param pluckValue _.pluck style callback
|
1442 | **/
|
1443 | select<T>(
|
1444 | pluckValue: string): LoDashArrayWrapper<T>;
|
1445 |
|
1446 | /**
|
1447 | * @see _.filter
|
1448 | * @param pluckValue _.pluck style callback
|
1449 | **/
|
1450 | select<W, T>(
|
1451 | whereValue: W): LoDashArrayWrapper<T>;
|
1452 | }
|
1453 |
|
1454 | //_.find
|
1455 | interface LoDashStatic {
|
1456 | /**
|
1457 | * Iterates over elements of a collection, returning the first element that the callback
|
1458 | * returns truey for. The callback is bound to thisArg and invoked with three arguments;
|
1459 | * (value, index|key, collection).
|
1460 | *
|
1461 | * If a property name is provided for callback the created "_.pluck" style callback will
|
1462 | * return the property value of the given element.
|
1463 | *
|
1464 | * If an object is provided for callback the created "_.where" style callback will return
|
1465 | * true for elements that have the properties of the given object, else false.
|
1466 | * @param collection Searches for a value in this list.
|
1467 | * @param callback The function called per iteration.
|
1468 | * @param thisArg The this binding of callback.
|
1469 | * @return The found element, else undefined.
|
1470 | **/
|
1471 | find<T>(
|
1472 | collection: Collection<T>,
|
1473 | callback: ListIterator<T, boolean>,
|
1474 | thisArg?: any): T;
|
1475 |
|
1476 | /**
|
1477 | * @see _.find
|
1478 | * @param _.pluck style callback
|
1479 | **/
|
1480 | find<W, T>(
|
1481 | collection: Collection<T>,
|
1482 | whereValue: W): T;
|
1483 |
|
1484 | /**
|
1485 | * @see _.find
|
1486 | * @param _.where style callback
|
1487 | **/
|
1488 | find<T>(
|
1489 | collection: Collection<T>,
|
1490 | pluckValue: string): T;
|
1491 |
|
1492 | /**
|
1493 | * @see _.find
|
1494 | **/
|
1495 | detect<T>(
|
1496 | collection: Collection<T>,
|
1497 | callback: ListIterator<T, boolean>,
|
1498 | thisArg?: any): T;
|
1499 |
|
1500 | /**
|
1501 | * @see _.find
|
1502 | * @param _.pluck style callback
|
1503 | **/
|
1504 | detect<W, T>(
|
1505 | collection: Collection<T>,
|
1506 | whereValue: W): T;
|
1507 |
|
1508 | /**
|
1509 | * @see _.find
|
1510 | * @param _.where style callback
|
1511 | **/
|
1512 | detect<T>(
|
1513 | collection: Collection<T>,
|
1514 | pluckValue: string): T;
|
1515 |
|
1516 | /**
|
1517 | * @see _.find
|
1518 | **/
|
1519 | findWhere<T>(
|
1520 | collection: Collection<T>,
|
1521 | callback: ListIterator<T, boolean>,
|
1522 | thisArg?: any): T;
|
1523 |
|
1524 | /**
|
1525 | * @see _.find
|
1526 | * @param _.pluck style callback
|
1527 | **/
|
1528 | findWhere<W, T>(
|
1529 | collection: Collection<T>,
|
1530 | whereValue: W): T;
|
1531 |
|
1532 | /**
|
1533 | * @see _.find
|
1534 | * @param _.where style callback
|
1535 | **/
|
1536 | findWhere<T>(
|
1537 | collection: Collection<T>,
|
1538 | pluckValue: string): T;
|
1539 | }
|
1540 |
|
1541 | //_.findLast
|
1542 | interface LoDashStatic {
|
1543 | /**
|
1544 | * This method is like _.find except that it iterates over elements of a collection from
|
1545 | * right to left.
|
1546 | * @param collection Searches for a value in this list.
|
1547 | * @param callback The function called per iteration.
|
1548 | * @param thisArg The this binding of callback.
|
1549 | * @return The found element, else undefined.
|
1550 | **/
|
1551 | findLast<T>(
|
1552 | collection: Collection<T>,
|
1553 | callback: ListIterator<T, boolean>,
|
1554 | thisArg?: any): T;
|
1555 |
|
1556 | /**
|
1557 | * @see _.find
|
1558 | * @param _.pluck style callback
|
1559 | **/
|
1560 | findLast<W, T>(
|
1561 | collection: Collection<T>,
|
1562 | whereValue: W): T;
|
1563 |
|
1564 | /**
|
1565 | * @see _.find
|
1566 | * @param _.where style callback
|
1567 | **/
|
1568 | findLast<T>(
|
1569 | collection: Collection<T>,
|
1570 | pluckValue: string): T;
|
1571 | }
|
1572 |
|
1573 | //_.forEach
|
1574 | interface LoDashStatic {
|
1575 | /**
|
1576 | * Iterates over elements of a collection, executing the callback for each element.
|
1577 | * The callback is bound to thisArg and invoked with three arguments; (value, index|key,
|
1578 | * collection). Callbacks may exit iteration early by explicitly returning false.
|
1579 | * @param collection The collection to iterate over.
|
1580 | * @param callback The function called per iteration.
|
1581 | * @param thisArg The this binding of callback.
|
1582 | **/
|
1583 | forEach<T>(
|
1584 | collection: List<T>,
|
1585 | callback: ListIterator<T, void >,
|
1586 | thisArg?: any): List<T>;
|
1587 |
|
1588 | /**
|
1589 | * @see _.forEach
|
1590 | **/
|
1591 | forEach<T extends {}>(
|
1592 | object: Dictionary<T>,
|
1593 | callback: ObjectIterator<T, void >,
|
1594 | thisArg?: any): Dictionary<T>;
|
1595 |
|
1596 | /**
|
1597 | * @see _.forEach
|
1598 | **/
|
1599 | each<T>(
|
1600 | collection: List<T>,
|
1601 | callback: ListIterator<T, void>,
|
1602 | thisArg?: any): List<T>;
|
1603 |
|
1604 | /**
|
1605 | * @see _.forEach
|
1606 | * @param object The object to iterate over
|
1607 | * @param callback The function called per iteration.
|
1608 | * @param thisArg The this binding of callback.
|
1609 | **/
|
1610 | each<T extends {}>(
|
1611 | object: Dictionary<T>,
|
1612 | callback: ObjectIterator<T, void>,
|
1613 | thisArg?: any): Dictionary<T>;
|
1614 | }
|
1615 |
|
1616 | interface LoDashArrayWrapper<T> {
|
1617 | /**
|
1618 | * @see _.forEach
|
1619 | **/
|
1620 | forEach<T>(
|
1621 | callback: ListIterator<T, void >,
|
1622 | thisArg?: any): LoDashArrayWrapper<T>;
|
1623 |
|
1624 | /**
|
1625 | * @see _.forEach
|
1626 | **/
|
1627 | each<T>(
|
1628 | callback: ListIterator<T, void >,
|
1629 | thisArg?: any): LoDashArrayWrapper<T>;
|
1630 | }
|
1631 |
|
1632 | interface LoDashObjectWrapper<T> {
|
1633 | /**
|
1634 | * @see _.forEach
|
1635 | **/
|
1636 | forEach<T extends {}>(
|
1637 | callback: ObjectIterator<T, void >,
|
1638 | thisArg?: any): LoDashObjectWrapper<T>;
|
1639 |
|
1640 | /**
|
1641 | * @see _.forEach
|
1642 | **/
|
1643 | each<T extends {}>(
|
1644 | callback: ObjectIterator<T, void >,
|
1645 | thisArg?: any): LoDashObjectWrapper<T>;
|
1646 | }
|
1647 |
|
1648 | //_.forEachRight
|
1649 | interface LoDashStatic {
|
1650 | /**
|
1651 | * This method is like _.forEach except that it iterates over elements of a
|
1652 | * collection from right to left.
|
1653 | * @param collection The collection to iterate over.
|
1654 | * @param callback The function called per iteration.
|
1655 | * @param thisArg The this binding of callback.
|
1656 | **/
|
1657 | forEachRight<T>(
|
1658 | collection: List<T>,
|
1659 | callback: ListIterator<T, void >,
|
1660 | thisArg?: any): List<T>;
|
1661 |
|
1662 | /**
|
1663 | * @see _.forEachRight
|
1664 | **/
|
1665 | forEachRight<T extends {}>(
|
1666 | object: Dictionary<T>,
|
1667 | callback: ObjectIterator<T, void >,
|
1668 | thisArg?: any): Dictionary<T>;
|
1669 |
|
1670 | /**
|
1671 | * @see _.forEachRight
|
1672 | **/
|
1673 | eachRight<T>(
|
1674 | collection: List<T>,
|
1675 | callback: ListIterator<T, void>,
|
1676 | thisArg?: any): List<T>;
|
1677 |
|
1678 | /**
|
1679 | * @see _.forEachRight
|
1680 | * @param object The object to iterate over
|
1681 | * @param callback The function called per iteration.
|
1682 | * @param thisArg The this binding of callback.
|
1683 | **/
|
1684 | eachRight<T extends {}>(
|
1685 | object: Dictionary<T>,
|
1686 | callback: ObjectIterator<T, void>,
|
1687 | thisArg?: any): Dictionary<T>;
|
1688 | }
|
1689 |
|
1690 | interface LoDashArrayWrapper<T> {
|
1691 | /**
|
1692 | * @see _.forEachRight
|
1693 | **/
|
1694 | forEachRight<T>(
|
1695 | callback: ListIterator<T, void >,
|
1696 | thisArg?: any): LoDashArrayWrapper<T>;
|
1697 |
|
1698 | /**
|
1699 | * @see _.forEachRight
|
1700 | **/
|
1701 | eachRight<T>(
|
1702 | callback: ListIterator<T, void >,
|
1703 | thisArg?: any): LoDashArrayWrapper<T>;
|
1704 | }
|
1705 |
|
1706 | interface LoDashObjectWrapper<T> {
|
1707 | /**
|
1708 | * @see _.forEachRight
|
1709 | **/
|
1710 | forEachRight<T extends {}>(
|
1711 | callback: ObjectIterator<T, void >,
|
1712 | thisArg?: any): LoDashObjectWrapper<Dictionary<T>>;
|
1713 |
|
1714 | /**
|
1715 | * @see _.forEachRight
|
1716 | * @param object The object to iterate over
|
1717 | * @param callback The function called per iteration.
|
1718 | * @param thisArg The this binding of callback.
|
1719 | **/
|
1720 | eachRight<T extends {}>(
|
1721 | callback: ObjectIterator<T, void>,
|
1722 | thisArg?: any): LoDashObjectWrapper<Dictionary<T>>;
|
1723 | }
|
1724 |
|
1725 | //_.groupBy
|
1726 | interface LoDashStatic {
|
1727 | /**
|
1728 | * Creates an object composed of keys generated from the results of running each element
|
1729 | * of a collection through the callback. The corresponding value of each key is an array
|
1730 | * of the elements responsible for generating the key. The callback is bound to thisArg
|
1731 | * and invoked with three arguments; (value, index|key, collection).
|
1732 | *
|
1733 | * If a property name is provided for callback the created "_.pluck" style callback will
|
1734 | * return the property value of the given element.
|
1735 | * If an object is provided for callback the created "_.where" style callback will return
|
1736 | * true for elements that have the properties of the given object, else false
|
1737 | * @param collection The collection to iterate over.
|
1738 | * @param callback The function called per iteration.
|
1739 | * @param thisArg The this binding of callback.
|
1740 | * @return Returns the composed aggregate object.
|
1741 | **/
|
1742 | groupBy<T>(
|
1743 | collection: List<T>,
|
1744 | callback?: ListIterator<T, any>,
|
1745 | thisArg?: any): Dictionary<T[]>;
|
1746 |
|
1747 | /**
|
1748 | * @see _.groupBy
|
1749 | * @param pluckValue _.pluck style callback
|
1750 | **/
|
1751 | groupBy<T>(
|
1752 | collection: List<T>,
|
1753 | pluckValue: string): Dictionary<T[]>;
|
1754 |
|
1755 | /**
|
1756 | * @see _.groupBy
|
1757 | * @param whereValue _.where style callback
|
1758 | **/
|
1759 | groupBy<W, T>(
|
1760 | collection: List<T>,
|
1761 | whereValue: W): Dictionary<T[]>;
|
1762 | }
|
1763 |
|
1764 | interface LoDashArrayWrapper<T> {
|
1765 | /**
|
1766 | * @see _.groupBy
|
1767 | **/
|
1768 | groupBy<T>(
|
1769 | callback: ListIterator<T, any>,
|
1770 | thisArg?: any): _.LoDashObjectWrapper<Dictionary<T[]>>;
|
1771 |
|
1772 | /**
|
1773 | * @see _.groupBy
|
1774 | **/
|
1775 | groupBy<T>(
|
1776 | pluckValue: string): _.LoDashObjectWrapper<Dictionary<T[]>>;
|
1777 |
|
1778 | /**
|
1779 | * @see _.groupBy
|
1780 | **/
|
1781 | groupBy<W, T>(
|
1782 | whereValue: W): _.LoDashObjectWrapper<Dictionary<T[]>>;
|
1783 | }
|
1784 |
|
1785 | //_.indexBy
|
1786 | interface LoDashStatic {
|
1787 | /**
|
1788 | * Creates an object composed of keys generated from the results of running each element
|
1789 | * of the collection through the given callback. The corresponding value of each key is
|
1790 | * the last element responsible for generating the key. The callback is bound to thisArg
|
1791 | * and invoked with three arguments; (value, index|key, collection).
|
1792 | *
|
1793 | * If a property name is provided for callback the created "_.pluck" style callback will
|
1794 | * return the property value of the given element.
|
1795 | *
|
1796 | * If an object is provided for callback the created "_.where" style callback will return
|
1797 | * true for elements that have the properties of the given object, else false.
|
1798 | * @param collection The collection to iterate over.
|
1799 | * @param callback The function called per iteration.
|
1800 | * @param thisArg The this binding of callback.
|
1801 | * @return Returns the composed aggregate object.
|
1802 | **/
|
1803 | indexBy<T>(
|
1804 | list: List<T>,
|
1805 | iterator: ListIterator<T, any>,
|
1806 | context?: any): Dictionary<T>;
|
1807 |
|
1808 | /**
|
1809 | * @see _.indexBy
|
1810 | * @param pluckValue _.pluck style callback
|
1811 | **/
|
1812 | indexBy<T>(
|
1813 | collection: List<T>,
|
1814 | pluckValue: string): Dictionary<T>;
|
1815 |
|
1816 | /**
|
1817 | * @see _.indexBy
|
1818 | * @param whereValue _.where style callback
|
1819 | **/
|
1820 | indexBy<W, T>(
|
1821 | collection: List<T>,
|
1822 | whereValue: W): Dictionary<T>;
|
1823 | }
|
1824 |
|
1825 | //_.invoke
|
1826 | interface LoDashStatic {
|
1827 | /**
|
1828 | * Invokes the method named by methodName on each element in the collection returning
|
1829 | * an array of the results of each invoked method. Additional arguments will be provided
|
1830 | * to each invoked method. If methodName is a function it will be invoked for, and this
|
1831 | * bound to, each element in the collection.
|
1832 | * @param collection The collection to iterate over.
|
1833 | * @param methodName The name of the method to invoke.
|
1834 | * @param args Arguments to invoke the method with.
|
1835 | **/
|
1836 | invoke<T extends {}>(
|
1837 | collection: Collection<T>,
|
1838 | methodName: string,
|
1839 | ...args: any[]): any;
|
1840 |
|
1841 | /**
|
1842 | * @see _.invoke
|
1843 | **/
|
1844 | invoke<T extends {}>(
|
1845 | collection: Collection<T>,
|
1846 | method: Function,
|
1847 | ...args: any[]): any;
|
1848 | }
|
1849 |
|
1850 | //_.map
|
1851 | interface LoDashStatic {
|
1852 | /**
|
1853 | * Creates an array of values by running each element in the collection through the callback.
|
1854 | * The callback is bound to thisArg and invoked with three arguments; (value, index|key,
|
1855 | * collection).
|
1856 | *
|
1857 | * If a property name is provided for callback the created "_.pluck" style callback will return
|
1858 | * the property value of the given element.
|
1859 | *
|
1860 | * If an object is provided for callback the created "_.where" style callback will return true
|
1861 | * for elements that have the properties of the given object, else false.
|
1862 | * @param collection The collection to iterate over.
|
1863 | * @param callback The function called per iteration.
|
1864 | * @param theArg The this binding of callback.
|
1865 | * @return The mapped array result.
|
1866 | **/
|
1867 | map<T, TResult>(
|
1868 | collection: List<T>,
|
1869 | callback: ListIterator<T, TResult>,
|
1870 | thisArg?: any): TResult[];
|
1871 |
|
1872 | /**
|
1873 | * @see _.map
|
1874 | * @param object The object to iterate over.
|
1875 | * @param callback The function called per iteration.
|
1876 | * @param thisArg `this` object in `iterator`, optional.
|
1877 | * @return The mapped object result.
|
1878 | **/
|
1879 | map<T extends {}, TResult>(
|
1880 | object: Dictionary<T>,
|
1881 | callback: ObjectIterator<T, TResult>,
|
1882 | thisArg?: any): TResult[];
|
1883 |
|
1884 | /**
|
1885 | * @see _.map
|
1886 | * @param pluckValue _.pluck style callback
|
1887 | **/
|
1888 | map<T, TResult>(
|
1889 | collection: List<T>,
|
1890 | pluckValue: string): TResult[];
|
1891 |
|
1892 | /**
|
1893 | * @see _.map
|
1894 | **/
|
1895 | collect<T, TResult>(
|
1896 | collection: List<T>,
|
1897 | callback: ListIterator<T, TResult>,
|
1898 | thisArg?: any): TResult[];
|
1899 |
|
1900 | /**
|
1901 | * @see _.map
|
1902 | **/
|
1903 | collect<T extends {}, TResult>(
|
1904 | object: Dictionary<T>,
|
1905 | callback: ObjectIterator<T, TResult>,
|
1906 | thisArg?: any): TResult[];
|
1907 |
|
1908 | /**
|
1909 | * @see _.map
|
1910 | **/
|
1911 | collect<T, TResult>(
|
1912 | collection: List<T>,
|
1913 | pluckValue: string): TResult[];
|
1914 | }
|
1915 |
|
1916 | interface LoDashArrayWrapper<T> {
|
1917 | /**
|
1918 | * @see _.map
|
1919 | **/
|
1920 | map<T, TResult>(
|
1921 | callback: ListIterator<T, TResult>,
|
1922 | thisArg?: any): LoDashArrayWrapper<TResult>;
|
1923 |
|
1924 | /**
|
1925 | * @see _.map
|
1926 | * @param pluckValue _.pluck style callback
|
1927 | **/
|
1928 | map<T, TResult>(
|
1929 | pluckValue: string): LoDashArrayWrapper<TResult>;
|
1930 |
|
1931 | /**
|
1932 | * @see _.map
|
1933 | **/
|
1934 | collect<T, TResult>(
|
1935 | callback: ListIterator<T, TResult>,
|
1936 | thisArg?: any): LoDashArrayWrapper<TResult>;
|
1937 |
|
1938 | /**
|
1939 | * @see _.map
|
1940 | **/
|
1941 | collect<T, TResult>(
|
1942 | pluckValue: string): LoDashArrayWrapper<TResult>;
|
1943 | }
|
1944 |
|
1945 | interface LoDashObjectWrapper<T> {
|
1946 | /**
|
1947 | * @see _.map
|
1948 | **/
|
1949 | map<T extends {}, TResult>(
|
1950 | callback: ObjectIterator<T, TResult>,
|
1951 | thisArg?: any): LoDashObjectWrapper<TResult>;
|
1952 |
|
1953 | /**
|
1954 | * @see _.map
|
1955 | **/
|
1956 | collect<T extends {}, TResult>(
|
1957 | callback: ObjectIterator<T, TResult>,
|
1958 | thisArg?: any): LoDashObjectWrapper<TResult>;
|
1959 | }
|
1960 |
|
1961 | //_.max
|
1962 | interface LoDashStatic {
|
1963 | /**
|
1964 | * Retrieves the maximum value of a collection. If the collection is empty or falsey -Infinity is
|
1965 | * returned. If a callback is provided it will be executed for each value in the collection to
|
1966 | * generate the criterion by which the value is ranked. The callback is bound to thisArg and invoked
|
1967 | * with three arguments; (value, index, collection).
|
1968 | *
|
1969 | * If a property name is provided for callback the created "_.pluck" style callback will return the
|
1970 | * property value of the given element.
|
1971 | *
|
1972 | * If an object is provided for callback the created "_.where" style callback will return true for
|
1973 | * elements that have the properties of the given object, else false.
|
1974 | * @param collection The collection to iterate over.
|
1975 | * @param callback The function called per iteration.
|
1976 | * @param thisArg The this binding of callback.
|
1977 | * @return Returns the maximum value.
|
1978 | **/
|
1979 | max<T>(
|
1980 | collection: Collection<T>,
|
1981 | callback?: ListIterator<T, any>,
|
1982 | thisArg?: any): T;
|
1983 |
|
1984 | /**
|
1985 | * @see _.max
|
1986 | * @param pluckValue _.pluck style callback
|
1987 | **/
|
1988 | max<T>(
|
1989 | collection: Collection<T>,
|
1990 | pluckValue: string): T;
|
1991 |
|
1992 | /**
|
1993 | * @see _.max
|
1994 | * @param whereValue _.where style callback
|
1995 | **/
|
1996 | max<W, T>(
|
1997 | collection: Collection<T>,
|
1998 | whereValue: W): T;
|
1999 | }
|
2000 |
|
2001 | //_.min
|
2002 | interface LoDashStatic {
|
2003 | /**
|
2004 | * Retrieves the minimum value of a collection. If the collection is empty or falsey
|
2005 | * Infinity is returned. If a callback is provided it will be executed for each value
|
2006 | * in the collection to generate the criterion by which the value is ranked. The callback
|
2007 | * is bound to thisArg and invoked with three arguments; (value, index, collection).
|
2008 | *
|
2009 | * If a property name is provided for callback the created "_.pluck" style callback
|
2010 | * will return the property value of the given element.
|
2011 | *
|
2012 | * If an object is provided for callback the created "_.where" style callback will
|
2013 | * return true for elements that have the properties of the given object, else false.
|
2014 | * @param collection The collection to iterate over.
|
2015 | * @param callback The function called per iteration.
|
2016 | * @param thisArg The this binding of callback.
|
2017 | * @return Returns the maximum value.
|
2018 | **/
|
2019 | min<T>(
|
2020 | collection: Collection<T>,
|
2021 | callback?: ListIterator<T, any>,
|
2022 | thisArg?: any): T;
|
2023 |
|
2024 | /**
|
2025 | * @see _.min
|
2026 | * @param pluckValue _.pluck style callback
|
2027 | **/
|
2028 | min<T>(
|
2029 | collection: Collection<T>,
|
2030 | pluckValue: string): T;
|
2031 |
|
2032 | /**
|
2033 | * @see _.min
|
2034 | * @param whereValue _.where style callback
|
2035 | **/
|
2036 | min<W, T>(
|
2037 | collection: Collection<T>,
|
2038 | whereValue: W): T;
|
2039 | }
|
2040 |
|
2041 | //_.pluck
|
2042 | interface LoDashStatic {
|
2043 | /**
|
2044 | * Retrieves the value of a specified property from all elements in the collection.
|
2045 | * @param collection The collection to iterate over.
|
2046 | * @param property The property to pluck.
|
2047 | * @return A new array of property values.
|
2048 | **/
|
2049 | pluck<T extends {}>(
|
2050 | collection: Collection<T>,
|
2051 | property: string): any[];
|
2052 | }
|
2053 |
|
2054 | //_.reduce
|
2055 | interface LoDashStatic {
|
2056 | /**
|
2057 | * Reduces a collection to a value which is the accumulated result of running each
|
2058 | * element in the collection through the callback, where each successive callback execution
|
2059 | * consumes the return value of the previous execution. If accumulator is not provided the
|
2060 | * first element of the collection will be used as the initial accumulator value. The callback
|
2061 | * is bound to thisArg and invoked with four arguments; (accumulator, value, index|key, collection).
|
2062 | * @param collection The collection to iterate over.
|
2063 | * @param callback The function called per iteration.
|
2064 | * @param accumulator Initial value of the accumulator.
|
2065 | * @param thisArg The this binding of callback.
|
2066 | * @return Returns the accumulated value.
|
2067 | **/
|
2068 | reduce<T, TResult>(
|
2069 | collection: Collection<T>,
|
2070 | callback: MemoIterator<T, TResult>,
|
2071 | accumulator: TResult,
|
2072 | thisArg?: any): TResult;
|
2073 |
|
2074 | /**
|
2075 | * @see _.reduce
|
2076 | **/
|
2077 | reduce<T, TResult>(
|
2078 | collection: Collection<T>,
|
2079 | callback: MemoIterator<T, TResult>,
|
2080 | thisArg?: any): TResult;
|
2081 |
|
2082 | /**
|
2083 | * @see _.reduce
|
2084 | **/
|
2085 | inject<T, TResult>(
|
2086 | collection: Collection<T>,
|
2087 | callback: MemoIterator<T, TResult>,
|
2088 | accumulator: TResult,
|
2089 | thisArg?: any): TResult;
|
2090 |
|
2091 | /**
|
2092 | * @see _.reduce
|
2093 | **/
|
2094 | inject<T, TResult>(
|
2095 | collection: Collection<T>,
|
2096 | callback: MemoIterator<T, TResult>,
|
2097 | thisArg?: any): TResult;
|
2098 |
|
2099 | /**
|
2100 | * @see _.reduce
|
2101 | **/
|
2102 | foldl<T, TResult>(
|
2103 | collection: Collection<T>,
|
2104 | callback: MemoIterator<T, TResult>,
|
2105 | accumulator: TResult,
|
2106 | thisArg?: any): TResult;
|
2107 |
|
2108 | /**
|
2109 | * @see _.reduce
|
2110 | **/
|
2111 | foldl<T, TResult>(
|
2112 | collection: Collection<T>,
|
2113 | callback: MemoIterator<T, TResult>,
|
2114 | thisArg?: any): TResult;
|
2115 | }
|
2116 |
|
2117 | //_.reduceRight
|
2118 | interface LoDashStatic {
|
2119 | /**
|
2120 | * This method is like _.reduce except that it iterates over elements of a collection from
|
2121 | * right to left.
|
2122 | * @param collection The collection to iterate over.
|
2123 | * @param callback The function called per iteration.
|
2124 | * @param accumulator Initial value of the accumulator.
|
2125 | * @param thisArg The this binding of callback.
|
2126 | * @return The accumulated value.
|
2127 | **/
|
2128 | reduceRight<T, TResult>(
|
2129 | collection: Collection<T>,
|
2130 | callback: MemoIterator<T, TResult>,
|
2131 | accumulator: TResult,
|
2132 | thisArg?: any): TResult;
|
2133 |
|
2134 | /**
|
2135 | * @see _.reduceRight
|
2136 | **/
|
2137 | reduceRight<T, TResult>(
|
2138 | collection: Collection<T>,
|
2139 | callback: MemoIterator<T, TResult>,
|
2140 | thisArg?: any): TResult;
|
2141 |
|
2142 | /**
|
2143 | * @see _.reduceRight
|
2144 | **/
|
2145 | foldr<T, TResult>(
|
2146 | collection: Collection<T>,
|
2147 | callback: MemoIterator<T, TResult>,
|
2148 | accumulator: TResult,
|
2149 | thisArg?: any): TResult;
|
2150 |
|
2151 | /**
|
2152 | * @see _.reduceRight
|
2153 | **/
|
2154 | foldr<T, TResult>(
|
2155 | collection: Collection<T>,
|
2156 | callback: MemoIterator<T, TResult>,
|
2157 | thisArg?: any): TResult;
|
2158 | }
|
2159 |
|
2160 | //_.reject
|
2161 | interface LoDashStatic {
|
2162 | /**
|
2163 | * The opposite of _.filter this method returns the elements of a collection that
|
2164 | * the callback does not return truey for.
|
2165 | *
|
2166 | * If a property name is provided for callback the created "_.pluck" style callback
|
2167 | * will return the property value of the given element.
|
2168 | *
|
2169 | * If an object is provided for callback the created "_.where" style callback will
|
2170 | * return true for elements that have the properties of the given object, else false.
|
2171 | * @param collection The collection to iterate over.
|
2172 | * @param callback The function called per iteration.
|
2173 | * @param thisArg The this binding of callback.
|
2174 | * @return A new array of elements that failed the callback check.
|
2175 | **/
|
2176 | reject<T>(
|
2177 | collection: Collection<T>,
|
2178 | callback: ListIterator<T, boolean>,
|
2179 | thisArg?: any): T[];
|
2180 |
|
2181 | /**
|
2182 | * @see _.reject
|
2183 | * @param pluckValue _.pluck style callback
|
2184 | **/
|
2185 | reject<T>(
|
2186 | collection: Collection<T>,
|
2187 | pluckValue: string): T[];
|
2188 |
|
2189 | /**
|
2190 | * @see _.reject
|
2191 | * @param whereValue _.where style callback
|
2192 | **/
|
2193 | reject<W, T>(
|
2194 | collection: Collection<T>,
|
2195 | whereValue: W): T[];
|
2196 | }
|
2197 |
|
2198 | //_.sample
|
2199 | interface LoDashStatic {
|
2200 | /**
|
2201 | * Retrieves a random element or n random elements from a collection.
|
2202 | * @param collection The collection to sample.
|
2203 | * @return Returns the random sample(s) of collection.
|
2204 | **/
|
2205 | sample<T>(collection: Collection<T>): T;
|
2206 |
|
2207 | /**
|
2208 | * @see _.sample
|
2209 | * @param n The number of elements to sample.
|
2210 | **/
|
2211 | sample<T>(collection: Collection<T>, n: number): T[];
|
2212 | }
|
2213 |
|
2214 | //_.shuffle
|
2215 | interface LoDashStatic {
|
2216 | /**
|
2217 | * Creates an array of shuffled values, using a version of the Fisher-Yates shuffle.
|
2218 | * See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle.
|
2219 | * @param collection The collection to shuffle.
|
2220 | * @return Returns a new shuffled collection.
|
2221 | **/
|
2222 | shuffle<T>(collection: Collection<T>): T[];
|
2223 | }
|
2224 |
|
2225 | //_.size
|
2226 | interface LoDashStatic {
|
2227 | /**
|
2228 | * Gets the size of the collection by returning collection.length for arrays and array-like
|
2229 | * objects or the number of own enumerable properties for objects.
|
2230 | * @param collection The collection to inspect.
|
2231 | * @return collection.length
|
2232 | **/
|
2233 | size<T>(collection: List<T>): number;
|
2234 |
|
2235 | /**
|
2236 | * @see _.size
|
2237 | * @param object The object to inspect
|
2238 | * @return The number of own enumerable properties.
|
2239 | **/
|
2240 | size<T extends {}>(object: T): number;
|
2241 |
|
2242 | /**
|
2243 | * @see _.size
|
2244 | * @param aString The string to inspect
|
2245 | * @return The length of aString
|
2246 | **/
|
2247 | size(aString: string): number;
|
2248 | }
|
2249 |
|
2250 | //_.some
|
2251 | interface LoDashStatic {
|
2252 | /**
|
2253 | * Checks if the callback returns a truey value for any element of a collection. The function
|
2254 | * returns as soon as it finds a passing value and does not iterate over the entire collection.
|
2255 | * The callback is bound to thisArg and invoked with three arguments; (value, index|key, collection).
|
2256 | *
|
2257 | * If a property name is provided for callback the created "_.pluck" style callback will return
|
2258 | * the property value of the given element.
|
2259 | *
|
2260 | * If an object is provided for callback the created "_.where" style callback will return true for
|
2261 | * elements that have the properties of the given object, else false.
|
2262 | * @param collection The collection to iterate over.
|
2263 | * @param callback The function called per iteration.
|
2264 | * @param thisArg The this binding of callback.
|
2265 | * @return True if any element passed the callback check, else false.
|
2266 | **/
|
2267 | some<T>(
|
2268 | collection: Collection<T>,
|
2269 | callback?: ListIterator<T, boolean>,
|
2270 | thisArg?: any): boolean;
|
2271 |
|
2272 | /**
|
2273 | * @see _.some
|
2274 | * @param pluckValue _.pluck style callback
|
2275 | **/
|
2276 | some<T>(
|
2277 | collection: Collection<T>,
|
2278 | pluckValue: string): boolean;
|
2279 |
|
2280 | /**
|
2281 | * @see _.some
|
2282 | * @param whereValue _.where style callback
|
2283 | **/
|
2284 | some<W, T>(
|
2285 | collection: Collection<T>,
|
2286 | whereValue: W): boolean;
|
2287 |
|
2288 | /**
|
2289 | * @see _.some
|
2290 | **/
|
2291 | any<T>(
|
2292 | collection: Collection<T>,
|
2293 | callback?: ListIterator<T, boolean>,
|
2294 | thisArg?: any): boolean;
|
2295 |
|
2296 | /**
|
2297 | * @see _.some
|
2298 | * @param pluckValue _.pluck style callback
|
2299 | **/
|
2300 | any<T>(
|
2301 | collection: Collection<T>,
|
2302 | pluckValue: string): boolean;
|
2303 |
|
2304 | /**
|
2305 | * @see _.some
|
2306 | * @param whereValue _.where style callback
|
2307 | **/
|
2308 | any<W, T>(
|
2309 | collection: Collection<T>,
|
2310 | whereValue: W): boolean;
|
2311 | }
|
2312 |
|
2313 | //_.sortBy
|
2314 | interface LoDashStatic {
|
2315 | /**
|
2316 | * Creates an array of elements, sorted in ascending order by the results of running each
|
2317 | * element in a collection through the callback. This method performs a stable sort, that
|
2318 | * is, it will preserve the original sort order of equal elements. The callback is bound
|
2319 | * to thisArg and invoked with three arguments; (value, index|key, collection).
|
2320 | *
|
2321 | * If a property name is provided for callback the created "_.pluck" style callback will
|
2322 | * return the property value of the given element.
|
2323 | *
|
2324 | * If an object is provided for callback the created "_.where" style callback will return
|
2325 | * true for elements that have the properties of the given object, else false.
|
2326 | * @param collection The collection to iterate over.
|
2327 | * @param callback The function called per iteration.
|
2328 | * @param thisArg The this binding of callback.
|
2329 | * @return A new array of sorted elements.
|
2330 | **/
|
2331 | sortBy<T, TSort>(
|
2332 | collection: List<T>,
|
2333 | callback?: ListIterator<T, TSort>,
|
2334 | thisArg?: any): T[];
|
2335 |
|
2336 | /**
|
2337 | * @see _.sortBy
|
2338 | * @param pluckValue _.pluck style callback
|
2339 | **/
|
2340 | sortBy<T>(
|
2341 | collection: List<T>,
|
2342 | pluckValue: string): T[];
|
2343 |
|
2344 | /**
|
2345 | * @see _.sortBy
|
2346 | * @param whereValue _.where style callback
|
2347 | **/
|
2348 | sortBy<W, T>(
|
2349 | collection: List<T>,
|
2350 | whereValue: W): T[];
|
2351 | }
|
2352 |
|
2353 | //_.toArray
|
2354 | interface LoDashStatic {
|
2355 | /**
|
2356 | * Converts the collection to an array.
|
2357 | * @param collection The collection to convert.
|
2358 | * @return The new converted array.
|
2359 | **/
|
2360 | toArray<T>(collection: Collection<T>): T[];
|
2361 | }
|
2362 |
|
2363 | //_.where
|
2364 | interface LoDashStatic {
|
2365 | /**
|
2366 | * Performs a deep comparison of each element in a collection to the given properties
|
2367 | * object, returning an array of all elements that have equivalent property values.
|
2368 | * @param collection The collection to iterate over.
|
2369 | * @param properties The object of property values to filter by.
|
2370 | * @return A new array of elements that have the given properties.
|
2371 | **/
|
2372 | where<T, U extends {}>(
|
2373 | list: Collection<T>,
|
2374 | properties: U): T[];
|
2375 | }
|
2376 |
|
2377 | /*************
|
2378 | * Functions *
|
2379 | *************/
|
2380 |
|
2381 | //_.after
|
2382 | interface LoDashStatic {
|
2383 | /**
|
2384 | * Creates a function that executes func, with the this binding and arguments of the
|
2385 | * created function, only after being called n times.
|
2386 | * @param n The number of times the function must be called before func is executed.
|
2387 | * @param func The function to restrict.
|
2388 | * @return The new restricted function.
|
2389 | **/
|
2390 | after(
|
2391 | n: number,
|
2392 | func: Function): Function;
|
2393 | }
|
2394 |
|
2395 | interface LoDashWrapper<T> {
|
2396 | /**
|
2397 | * @see _.after
|
2398 | **/
|
2399 | after(func: Function): LoDashObjectWrapper<Function>;
|
2400 | }
|
2401 |
|
2402 | //_.bind
|
2403 | interface LoDashStatic {
|
2404 | /**
|
2405 | * Creates a function that, when called, invokes func with the this binding of thisArg
|
2406 | * and prepends any additional bind arguments to those provided to the bound function.
|
2407 | * @param func The function to bind.
|
2408 | * @param thisArg The this binding of func.
|
2409 | * @param args Arguments to be partially applied.
|
2410 | * @return The new bound function.
|
2411 | **/
|
2412 | bind(
|
2413 | func: Function,
|
2414 | thisArg: any,
|
2415 | ...args: any[]): () => any;
|
2416 | }
|
2417 |
|
2418 | interface LoDashObjectWrapper<T> {
|
2419 | /**
|
2420 | * @see _.bind
|
2421 | **/
|
2422 | bind(
|
2423 | thisArg: any,
|
2424 | ...args: any[]): LoDashObjectWrapper<() => any>;
|
2425 | }
|
2426 |
|
2427 | //_.bindAll
|
2428 | interface LoDashStatic {
|
2429 | /**
|
2430 | * Binds methods of an object to the object itself, overwriting the existing method. Method
|
2431 | * names may be specified as individual arguments or as arrays of method names. If no method
|
2432 | * names are provided all the function properties of object will be bound.
|
2433 | * @param object The object to bind and assign the bound methods to.
|
2434 | * @param methodNames The object method names to bind, specified as individual method names
|
2435 | * or arrays of method names.
|
2436 | * @return object
|
2437 | **/
|
2438 | bindAll<T>(
|
2439 | object: T,
|
2440 | ...methodNames: string[]): T;
|
2441 | }
|
2442 |
|
2443 | interface LoDashObjectWrapper<T> {
|
2444 | /**
|
2445 | * @see _.bindAll
|
2446 | **/
|
2447 | bindAll<T>(...methodNames: string[]): LoDashWrapper<T>;
|
2448 | }
|
2449 |
|
2450 | //_.bindKey
|
2451 | interface LoDashStatic {
|
2452 | /**
|
2453 | * Creates a function that, when called, invokes the method at object[key] and prepends any
|
2454 | * additional bindKey arguments to those provided to the bound function. This method differs
|
2455 | * from _.bind by allowing bound functions to reference methods that will be redefined or don't
|
2456 | * yet exist. See http://michaux.ca/articles/lazy-function-definition-pattern.
|
2457 | * @param object The object the method belongs to.
|
2458 | * @param key The key of the method.
|
2459 | * @param args Arguments to be partially applied.
|
2460 | * @return The new bound function.
|
2461 | **/
|
2462 | bindKey<T>(
|
2463 | object: T,
|
2464 | key: string,
|
2465 | ...args: any[]): Function;
|
2466 | }
|
2467 |
|
2468 | interface LoDashObjectWrapper<T> {
|
2469 | /**
|
2470 | * @see _.bindKey
|
2471 | **/
|
2472 | bindKey(
|
2473 | key: string,
|
2474 | ...args: any[]): LoDashObjectWrapper<Function>;
|
2475 | }
|
2476 |
|
2477 | //_.compose
|
2478 | interface LoDashStatic {
|
2479 | /**
|
2480 | * Creates a function that is the composition of the provided functions, where each function
|
2481 | * consumes the return value of the function that follows. For example, composing the functions
|
2482 | * f(), g(), and h() produces f(g(h())). Each function is executed with the this binding of the
|
2483 | * composed function.
|
2484 | * @param funcs Functions to compose.
|
2485 | * @return The new composed function.
|
2486 | **/
|
2487 | compose(...funcs: Function[]): Function;
|
2488 | }
|
2489 |
|
2490 | interface LoDashObjectWrapper<T> {
|
2491 | /**
|
2492 | * @see _.compose
|
2493 | **/
|
2494 | compose(...funcs: Function[]): LoDashObjectWrapper<Function>;
|
2495 | }
|
2496 |
|
2497 | //_.createCallback
|
2498 | interface LoDashStatic {
|
2499 | /**
|
2500 | * Produces a callback bound to an optional thisArg. If func is a property name the created
|
2501 | * callback will return the property value for a given element. If func is an object the created
|
2502 | * callback will return true for elements that contain the equivalent object properties,
|
2503 | * otherwise it will return false.
|
2504 | * @param func The value to convert to a callback.
|
2505 | * @param thisArg The this binding of the created callback.
|
2506 | * @param argCount The number of arguments the callback accepts.
|
2507 | * @return A callback function.
|
2508 | **/
|
2509 | createCallback(
|
2510 | func: string,
|
2511 | thisArg?: any,
|
2512 | argCount?: number): () => any;
|
2513 |
|
2514 | /**
|
2515 | * @see _.createCallback
|
2516 | **/
|
2517 | createCallback(
|
2518 | func: Dictionary<any>,
|
2519 | thisArg?: any,
|
2520 | argCount?: number): () => boolean;
|
2521 | }
|
2522 |
|
2523 | interface LoDashWrapper<T> {
|
2524 | /**
|
2525 | * @see _.createCallback
|
2526 | **/
|
2527 | createCallback(
|
2528 | thisArg?: any,
|
2529 | argCount?: number): LoDashObjectWrapper<() => any>;
|
2530 | }
|
2531 |
|
2532 | interface LoDashObjectWrapper<T> {
|
2533 | /**
|
2534 | * @see _.createCallback
|
2535 | **/
|
2536 | createCallback(
|
2537 | thisArg?: any,
|
2538 | argCount?: number): LoDashObjectWrapper<() => any>;
|
2539 | }
|
2540 |
|
2541 | //_.curry
|
2542 | interface LoDashStatic {
|
2543 | /**
|
2544 | * Creates a function which accepts one or more arguments of func that when invoked either
|
2545 | * executes func returning its result, if all func arguments have been provided, or returns
|
2546 | * a function that accepts one or more of the remaining func arguments, and so on. The arity
|
2547 | * of func can be specified if func.length is not sufficient.
|
2548 | * @param func The function to curry.
|
2549 | * @param arity The arity of func.
|
2550 | * @return The new curried function.
|
2551 | **/
|
2552 | curry(
|
2553 | func: Function,
|
2554 | arity?: number): Function;
|
2555 | }
|
2556 |
|
2557 | interface LoDashObjectWrapper<T> {
|
2558 | /**
|
2559 | * @see _.curry
|
2560 | **/
|
2561 | curry(arity?: number): LoDashObjectWrapper<Function>;
|
2562 | }
|
2563 |
|
2564 | //_.debounce
|
2565 | interface LoDashStatic {
|
2566 | /**
|
2567 | * Creates a function that will delay the execution of func until after wait milliseconds have
|
2568 | * elapsed since the last time it was invoked. Provide an options object to indicate that func
|
2569 | * should be invoked on the leading and/or trailing edge of the wait timeout. Subsequent calls
|
2570 | * to the debounced function will return the result of the last func call.
|
2571 | *
|
2572 | * Note: If leading and trailing options are true func will be called on the trailing edge of
|
2573 | * the timeout only if the the debounced function is invoked more than once during the wait
|
2574 | * timeout.
|
2575 | * @param func The function to debounce.
|
2576 | * @param wait The number of milliseconds to delay.
|
2577 | * @param options The options object.
|
2578 | * @param options.leading Specify execution on the leading edge of the timeout.
|
2579 | * @param options.maxWait The maximum time func is allowed to be delayed before it’s called.
|
2580 | * @param options.trailing Specify execution on the trailing edge of the timeout.
|
2581 | * @return The new debounced function.
|
2582 | **/
|
2583 | debounce<T extends Function>(
|
2584 | func: T,
|
2585 | wait: number,
|
2586 | options?: DebounceSettings): T;
|
2587 | }
|
2588 |
|
2589 | interface LoDashObjectWrapper<T> {
|
2590 | /**
|
2591 | * @see _.debounce
|
2592 | **/
|
2593 | debounce(
|
2594 | wait: number,
|
2595 | options?: DebounceSettings): LoDashObjectWrapper<Function>;
|
2596 | }
|
2597 |
|
2598 | interface DebounceSettings {
|
2599 | /**
|
2600 | * Specify execution on the leading edge of the timeout.
|
2601 | **/
|
2602 | leading?: boolean;
|
2603 |
|
2604 | /**
|
2605 | * The maximum time func is allowed to be delayed before it’s called.
|
2606 | **/
|
2607 | maxWait?: number;
|
2608 |
|
2609 | /**
|
2610 | * Specify execution on the trailing edge of the timeout.
|
2611 | **/
|
2612 | trailing?: boolean;
|
2613 | }
|
2614 |
|
2615 | //_.defer
|
2616 | interface LoDashStatic {
|
2617 | /**
|
2618 | * Defers executing the func function until the current call stack has cleared. Additional
|
2619 | * arguments will be provided to func when it is invoked.
|
2620 | * @param func The function to defer.
|
2621 | * @param args Arguments to invoke the function with.
|
2622 | * @return The timer id.
|
2623 | **/
|
2624 | defer(
|
2625 | func: Function,
|
2626 | ...args: any[]): number;
|
2627 | }
|
2628 |
|
2629 | interface LoDashObjectWrapper<T> {
|
2630 | /**
|
2631 | * @see _.defer
|
2632 | **/
|
2633 | defer(...args: any[]): LoDashWrapper<number>;
|
2634 | }
|
2635 |
|
2636 | //_.delay
|
2637 | interface LoDashStatic {
|
2638 | /**
|
2639 | * Executes the func function after wait milliseconds. Additional arguments will be provided
|
2640 | * to func when it is invoked.
|
2641 | * @param func The function to delay.
|
2642 | * @param wait The number of milliseconds to delay execution.
|
2643 | * @param args Arguments to invoke the function with.
|
2644 | * @return The timer id.
|
2645 | **/
|
2646 | delay(
|
2647 | func: Function,
|
2648 | wait: number,
|
2649 | ...args: any[]): number;
|
2650 | }
|
2651 |
|
2652 | interface LoDashObjectWrapper<T> {
|
2653 | /**
|
2654 | * @see _.delay
|
2655 | **/
|
2656 | delay(
|
2657 | wait: number,
|
2658 | ...args: any[]): LoDashWrapper<number>;
|
2659 | }
|
2660 |
|
2661 | //_.memoize
|
2662 | interface LoDashStatic {
|
2663 | /**
|
2664 | * Creates a function that memoizes the result of func. If resolver is provided it will be
|
2665 | * used to determine the cache key for storing the result based on the arguments provided to
|
2666 | * the memoized function. By default, the first argument provided to the memoized function is
|
2667 | * used as the cache key. The func is executed with the this binding of the memoized function.
|
2668 | * The result cache is exposed as the cache property on the memoized function.
|
2669 | * @param func Computationally expensive function that will now memoized results.
|
2670 | * @param resolver Hash function for storing the result of `fn`.
|
2671 | * @return Returns the new memoizing function.
|
2672 | **/
|
2673 | memoize<T extends Function>(
|
2674 | func: T,
|
2675 | resolver?: Function): T;
|
2676 | }
|
2677 |
|
2678 | //_.once
|
2679 | interface LoDashStatic {
|
2680 | /**
|
2681 | * Creates a function that is restricted to execute func once. Repeat calls to the function
|
2682 | * will return the value of the first call. The func is executed with the this binding of the
|
2683 | * created function.
|
2684 | * @param func Function to only execute once.
|
2685 | * @return The new restricted function.
|
2686 | **/
|
2687 | once<T extends Function>(func: T): T;
|
2688 | }
|
2689 |
|
2690 | //_.partial
|
2691 | interface LoDashStatic {
|
2692 | /**
|
2693 | * Creates a function that, when called, invokes func with any additional partial arguments
|
2694 | * prepended to those provided to the new function. This method is similar to _.bind except
|
2695 | * it does not alter the this binding.
|
2696 | * @param func The function to partially apply arguments to.
|
2697 | * @param args Arguments to be partially applied.
|
2698 | * @return The new partially applied function.
|
2699 | **/
|
2700 | partial(
|
2701 | func: Function,
|
2702 | ...args: any[]): Function;
|
2703 | }
|
2704 |
|
2705 | //_.partialRight
|
2706 | interface LoDashStatic {
|
2707 | /**
|
2708 | * This method is like _.partial except that partial arguments are appended to those provided
|
2709 | * to the new function.
|
2710 | * @param func The function to partially apply arguments to.
|
2711 | * @param args Arguments to be partially applied.
|
2712 | * @return The new partially applied function.
|
2713 | **/
|
2714 | partialRight(
|
2715 | func: Function,
|
2716 | ...args: any[]): Function;
|
2717 | }
|
2718 |
|
2719 | //_.throttle
|
2720 | interface LoDashStatic {
|
2721 | /**
|
2722 | * Creates a function that, when executed, will only call the func function at most once per
|
2723 | * every wait milliseconds. Provide an options object to indicate that func should be invoked
|
2724 | * on the leading and/or trailing edge of the wait timeout. Subsequent calls to the throttled
|
2725 | * function will return the result of the last func call.
|
2726 | *
|
2727 | * Note: If leading and trailing options are true func will be called on the trailing edge of
|
2728 | * the timeout only if the the throttled function is invoked more than once during the wait timeout.
|
2729 | * @param func The function to throttle.
|
2730 | * @param wait The number of milliseconds to throttle executions to.
|
2731 | * @param options The options object.
|
2732 | * @param options.leading Specify execution on the leading edge of the timeout.
|
2733 | * @param options.trailing Specify execution on the trailing edge of the timeout.
|
2734 | * @return The new throttled function.
|
2735 | **/
|
2736 | throttle<T extends Function>(
|
2737 | func: T,
|
2738 | wait: number,
|
2739 | options?: ThrottleSettings): T;
|
2740 | }
|
2741 |
|
2742 | interface ThrottleSettings {
|
2743 |
|
2744 | /**
|
2745 | * If you'd like to disable the leading-edge call, pass this as false.
|
2746 | **/
|
2747 | leading?: boolean;
|
2748 |
|
2749 | /**
|
2750 | * If you'd like to disable the execution on the trailing-edge, pass false.
|
2751 | **/
|
2752 | trailing?: boolean;
|
2753 | }
|
2754 |
|
2755 | //_.wrap
|
2756 | interface LoDashStatic {
|
2757 | /**
|
2758 | * Creates a function that provides value to the wrapper function as its first argument.
|
2759 | * Additional arguments provided to the function are appended to those provided to the
|
2760 | * wrapper function. The wrapper is executed with the this binding of the created function.
|
2761 | * @param value The value to wrap.
|
2762 | * @param wrapper The wrapper function.
|
2763 | * @return The new function.
|
2764 | **/
|
2765 | wrap(
|
2766 | value: any,
|
2767 | wrapper: (func: Function, ...args: any[]) => any): Function;
|
2768 | }
|
2769 |
|
2770 | /*************
|
2771 | * Objects *
|
2772 | *************/
|
2773 |
|
2774 | //_.assign
|
2775 | interface LoDashStatic {
|
2776 | /**
|
2777 | * Assigns own enumerable properties of source object(s) to the destination object. Subsequent
|
2778 | * sources will overwrite property assignments of previous sources. If a callback is provided
|
2779 | * it will be executed to produce the assigned values. The callback is bound to thisArg and
|
2780 | * invoked with two arguments; (objectValue, sourceValue).
|
2781 | * @param object The destination object.
|
2782 | * @param s1-8 The source object(s)
|
2783 | * @param callback The function to customize merging properties.
|
2784 | * @param thisArg The this binding of callback.
|
2785 | * @return The destination object.
|
2786 | **/
|
2787 | assign<P, T, S1, Value, Result>(
|
2788 | object: T,
|
2789 | s1: S1,
|
2790 | callback?: (objectValue: Value, sourceValue: Value) => Value,
|
2791 | thisArg?: any): Result;
|
2792 |
|
2793 | /**
|
2794 | * @see _.assign
|
2795 | **/
|
2796 | assign<P, T, S1, S2, Value, Result>(
|
2797 | object: T,
|
2798 | s1: S1,
|
2799 | s2: S2,
|
2800 | callback?: (objectValue: Value, sourceValue: Value) => Value,
|
2801 | thisArg?: any): Result;
|
2802 |
|
2803 | /**
|
2804 | * @see _.assign
|
2805 | **/
|
2806 | assign<P, T, S1, S2, S3, Value, Result>(
|
2807 | object: T,
|
2808 | s1: S1,
|
2809 | s2: S2,
|
2810 | s3: S3,
|
2811 | callback?: (objectValue: Value, sourceValue: Value) => Value,
|
2812 | thisArg?: any): Result;
|
2813 |
|
2814 | /**
|
2815 | * @see _.assign
|
2816 | **/
|
2817 | assign<P, T, S1, S2, S3, S4, Value, Result>(
|
2818 | object: T,
|
2819 | s1: S1,
|
2820 | s2: S2,
|
2821 | s3: S3,
|
2822 | s4: S4,
|
2823 | callback?: (objectValue: Value, sourceValue: Value) => Value,
|
2824 | thisArg?: any): Result;
|
2825 |
|
2826 | /**
|
2827 | * @see _.assign
|
2828 | **/
|
2829 | extend<P, T, S1, Value, Result>(
|
2830 | object: T,
|
2831 | s1: S1,
|
2832 | callback?: (objectValue: Value, sourceValue: Value) => Value,
|
2833 | thisArg?: any): Result;
|
2834 |
|
2835 | /**
|
2836 | * @see _.assign
|
2837 | **/
|
2838 | extend<P, T, S1, S2, Value, Result>(
|
2839 | object: T,
|
2840 | s1: S1,
|
2841 | s2: S2,
|
2842 | callback?: (objectValue: Value, sourceValue: Value) => Value,
|
2843 | thisArg?: any): Result;
|
2844 |
|
2845 | /**
|
2846 | * @see _.assign
|
2847 | **/
|
2848 | extend<P, T, S1, S2, S3, Value, Result>(
|
2849 | object: T,
|
2850 | s1: S1,
|
2851 | s2: S2,
|
2852 | s3: S3,
|
2853 | callback?: (objectValue: Value, sourceValue: Value) => Value,
|
2854 | thisArg?: any): Result;
|
2855 |
|
2856 | /**
|
2857 | * @see _.assign
|
2858 | **/
|
2859 | extend<P, T, S1, S2, S3, S4, Value, Result>(
|
2860 | object: T,
|
2861 | s1: S1,
|
2862 | s2: S2,
|
2863 | s3: S3,
|
2864 | s4: S4,
|
2865 | callback?: (objectValue: Value, sourceValue: Value) => Value,
|
2866 | thisArg?: any): Result;
|
2867 | }
|
2868 |
|
2869 | interface LoDashObjectWrapper<T> {
|
2870 | /**
|
2871 | * @see _.assign
|
2872 | **/
|
2873 | assign<S1, Value, TResult>(
|
2874 | s1: S1,
|
2875 | callback?: (objectValue: Value, sourceValue: Value) => Value,
|
2876 | thisArg?: any): TResult;
|
2877 |
|
2878 | /**
|
2879 | * @see _.assign
|
2880 | **/
|
2881 | assign<S1, S2, Value, TResult>(
|
2882 | s1: S1,
|
2883 | s2: S2,
|
2884 | callback?: (objectValue: Value, sourceValue: Value) => Value,
|
2885 | thisArg?: any): TResult;
|
2886 | /**
|
2887 | * @see _.assign
|
2888 | **/
|
2889 | assign<S1, S2, S3, Value, TResult>(
|
2890 | s1: S1,
|
2891 | s2: S2,
|
2892 | s3: S3,
|
2893 | callback?: (objectValue: Value, sourceValue: Value) => Value,
|
2894 | thisArg?: any): TResult;
|
2895 | /**
|
2896 | * @see _.assign
|
2897 | **/
|
2898 | assign<S1, S2, S3, S4, Value, TResult>(
|
2899 | s1: S1,
|
2900 | s2: S2,
|
2901 | s3: S3,
|
2902 | s4: S4,
|
2903 | callback?: (objectValue: Value, sourceValue: Value) => Value,
|
2904 | thisArg?: any): TResult;
|
2905 | /**
|
2906 | * @see _.assign
|
2907 | **/
|
2908 | assign<S1, S2, S3, S4, S5, Value, TResult>(
|
2909 | s1: S1,
|
2910 | s2: S2,
|
2911 | s3: S3,
|
2912 | s4: S4,
|
2913 | s5: S5,
|
2914 | callback?: (objectValue: Value, sourceValue: Value) => Value,
|
2915 | thisArg?: any): TResult;
|
2916 |
|
2917 | /**
|
2918 | * @see _.assign
|
2919 | **/
|
2920 | extend<S1, Value, TResult>(
|
2921 | s1: S1,
|
2922 | callback?: (objectValue: Value, sourceValue: Value) => Value,
|
2923 | thisArg?: any): TResult;
|
2924 |
|
2925 | /**
|
2926 | * @see _.assign
|
2927 | **/
|
2928 | extend<S1, S2, Value, TResult>(
|
2929 | s1: S1,
|
2930 | s2: S2,
|
2931 | callback?: (objectValue: Value, sourceValue: Value) => Value,
|
2932 | thisArg?: any): TResult;
|
2933 | /**
|
2934 | * @see _.assign
|
2935 | **/
|
2936 | extend<S1, S2, S3, Value, TResult>(
|
2937 | s1: S1,
|
2938 | s2: S2,
|
2939 | s3: S3,
|
2940 | callback?: (objectValue: Value, sourceValue: Value) => Value,
|
2941 | thisArg?: any): TResult;
|
2942 | /**
|
2943 | * @see _.assign
|
2944 | **/
|
2945 | extend<S1, S2, S3, S4, Value, TResult>(
|
2946 | s1: S1,
|
2947 | s2: S2,
|
2948 | s3: S3,
|
2949 | s4: S4,
|
2950 | callback?: (objectValue: Value, sourceValue: Value) => Value,
|
2951 | thisArg?: any): TResult;
|
2952 | /**
|
2953 | * @see _.assign
|
2954 | **/
|
2955 | extend<S1, S2, S3, S4, S5, Value, TResult>(
|
2956 | s1: S1,
|
2957 | s2: S2,
|
2958 | s3: S3,
|
2959 | s4: S4,
|
2960 | s5: S5,
|
2961 | callback?: (objectValue: Value, sourceValue: Value) => Value,
|
2962 | thisArg?: any): TResult;
|
2963 |
|
2964 | }
|
2965 |
|
2966 | //_.clone
|
2967 | interface LoDashStatic {
|
2968 | /**
|
2969 | * Creates a clone of value. If deep is true nested objects will also be cloned, otherwise
|
2970 | * they will be assigned by reference. If a callback is provided it will be executed to produce
|
2971 | * the cloned values. If the callback returns undefined cloning will be handled by the method
|
2972 | * instead. The callback is bound to thisArg and invoked with one argument; (value).
|
2973 | * @param value The value to clone.
|
2974 | * @param deep Specify a deep clone.
|
2975 | * @param callback The function to customize cloning values.
|
2976 | * @param thisArg The this binding of callback.
|
2977 | * @return The cloned value.
|
2978 | **/
|
2979 | clone<T>(
|
2980 | value: T,
|
2981 | deep?: boolean,
|
2982 | callback?: (value: any) => any,
|
2983 | thisArg?: any): T;
|
2984 | }
|
2985 |
|
2986 | //_.cloneDeep
|
2987 | interface LoDashStatic {
|
2988 | /**
|
2989 | * Creates a deep clone of value. If a callback is provided it will be executed to produce the
|
2990 | * cloned values. If the callback returns undefined cloning will be handled by the method instead.
|
2991 | * The callback is bound to thisArg and invoked with one argument; (value).
|
2992 | *
|
2993 | * Note: This method is loosely based on the structured clone algorithm. Functions and DOM nodes
|
2994 | * are not cloned. The enumerable properties of arguments objects and objects created by constructors
|
2995 | * other than Object are cloned to plain Object objects.
|
2996 | * See http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm.
|
2997 | * @param value The value to clone.
|
2998 | * @param callback The function to customize cloning values.
|
2999 | * @param thisArg The this binding of callback.
|
3000 | * @return The cloned value.
|
3001 | **/
|
3002 | cloneDeep<T>(
|
3003 | value: T,
|
3004 | callback?: (value: any) => any,
|
3005 | thisArg?: any): T;
|
3006 | }
|
3007 |
|
3008 | //_.defaults
|
3009 | interface LoDashStatic {
|
3010 | /**
|
3011 | * Assigns own enumerable properties of source object(s) to the destination object for all
|
3012 | * destination properties that resolve to undefined. Once a property is set, additional defaults
|
3013 | * of the same property will be ignored.
|
3014 | * @param object The destination object.
|
3015 | * @param sources The source objects.
|
3016 | * @return The destination object.
|
3017 | **/
|
3018 | defaults<T, TResult>(
|
3019 | object: T,
|
3020 | ...sources: any[]): TResult;
|
3021 | }
|
3022 |
|
3023 | interface LoDashObjectWrapper<T> {
|
3024 | /**
|
3025 | * @see _.defaults
|
3026 | **/
|
3027 | defaults<T, TResult>(...sources: any[]): LoDashObjectWrapper<TResult>
|
3028 | }
|
3029 |
|
3030 | //_.findKey
|
3031 | interface LoDashStatic {
|
3032 | /**
|
3033 | * This method is like _.findIndex except that it returns the key of the first element that
|
3034 | * passes the callback check, instead of the element itself.
|
3035 | * @param object The object to search.
|
3036 | * @param callback The function called per iteration.
|
3037 | * @param thisArg The this binding of callback.
|
3038 | * @return The key of the found element, else undefined.
|
3039 | **/
|
3040 | findKey(
|
3041 | object: any,
|
3042 | callback: (value: any) => boolean,
|
3043 | thisArg?: any): string;
|
3044 |
|
3045 | /**
|
3046 | * @see _.findKey
|
3047 | * @param pluckValue _.pluck style callback
|
3048 | **/
|
3049 | findKey(
|
3050 | object: any,
|
3051 | pluckValue: string): string;
|
3052 |
|
3053 | /**
|
3054 | * @see _.findKey
|
3055 | * @param whereValue _.where style callback
|
3056 | **/
|
3057 | findKey<W extends Dictionary<any>, T>(
|
3058 | object: T,
|
3059 | whereValue: W): string;
|
3060 | }
|
3061 |
|
3062 | //_.findLastKey
|
3063 | interface LoDashStatic {
|
3064 | /**
|
3065 | * This method is like _.findKey except that it iterates over elements of a collection in the opposite order.
|
3066 | * @param object The object to search.
|
3067 | * @param callback The function called per iteration.
|
3068 | * @param thisArg The this binding of callback.
|
3069 | * @return The key of the found element, else undefined.
|
3070 | **/
|
3071 | findLastKey(
|
3072 | object: any,
|
3073 | callback: (value: any) => boolean,
|
3074 | thisArg?: any): string;
|
3075 |
|
3076 | /**
|
3077 | * @see _.findLastKey
|
3078 | * @param pluckValue _.pluck style callback
|
3079 | **/
|
3080 | findLastKey(
|
3081 | object: any,
|
3082 | pluckValue: string): string;
|
3083 |
|
3084 | /**
|
3085 | * @see _.findLastKey
|
3086 | * @param whereValue _.where style callback
|
3087 | **/
|
3088 | findLastKey<W extends Dictionary<any>, T>(
|
3089 | object: T,
|
3090 | whereValue: W): string;
|
3091 | }
|
3092 |
|
3093 | //_.forIn
|
3094 | interface LoDashStatic {
|
3095 | /**
|
3096 | * Iterates over own and inherited enumerable properties of an object, executing the callback for
|
3097 | * each property. The callback is bound to thisArg and invoked with three arguments; (value, key,
|
3098 | * object). Callbacks may exit iteration early by explicitly returning false.
|
3099 | * @param object The object to iterate over.
|
3100 | * @param callback The function called per iteration.
|
3101 | * @param thisArg The this binding of callback.
|
3102 | * @return object
|
3103 | **/
|
3104 | forIn<T>(
|
3105 | object: Dictionary<T>,
|
3106 | callback?: ObjectIterator<T, void>,
|
3107 | thisArg?: any): Dictionary<T>;
|
3108 | }
|
3109 |
|
3110 | interface LoDashObjectWrapper<T> {
|
3111 | /**
|
3112 | * @see _.forIn
|
3113 | **/
|
3114 | forIn<T extends {}>(
|
3115 | callback: ObjectIterator<T, void>,
|
3116 | thisArg?: any): _.LoDashObjectWrapper<T>;
|
3117 | }
|
3118 |
|
3119 | //_.forInRight
|
3120 | interface LoDashStatic {
|
3121 | /**
|
3122 | * This method is like _.forIn except that it iterates over elements of a collection in the
|
3123 | * opposite order.
|
3124 | * @param object The object to iterate over.
|
3125 | * @param callback The function called per iteration.
|
3126 | * @param thisArg The this binding of callback.
|
3127 | * @return object
|
3128 | **/
|
3129 | forInRight<T extends {}>(
|
3130 | object: Dictionary<T>,
|
3131 | callback?: ObjectIterator<T, void>,
|
3132 | thisArg?: any): Dictionary<T>;
|
3133 | }
|
3134 |
|
3135 | interface LoDashObjectWrapper<T> {
|
3136 | /**
|
3137 | * @see _.forInRight
|
3138 | **/
|
3139 | forInRight<T extends {}>(
|
3140 | callback: ObjectIterator<T, void>,
|
3141 | thisArg?: any): _.LoDashObjectWrapper<T>;
|
3142 | }
|
3143 |
|
3144 | //_.forOwn
|
3145 | interface LoDashStatic {
|
3146 | /**
|
3147 | * Iterates over own enumerable properties of an object, executing the callback for each
|
3148 | * property. The callback is bound to thisArg and invoked with three arguments; (value, key,
|
3149 | * object). Callbacks may exit iteration early by explicitly returning false.
|
3150 | * @param object The object to iterate over.
|
3151 | * @param callback The function called per iteration.
|
3152 | * @param thisArg The this binding of callback.
|
3153 | * @return object
|
3154 | **/
|
3155 | forOwn<T extends {}>(
|
3156 | object: Dictionary<T>,
|
3157 | callback?: ObjectIterator<T, void>,
|
3158 | thisArg?: any): Dictionary<T>;
|
3159 | }
|
3160 |
|
3161 | interface LoDashObjectWrapper<T> {
|
3162 | /**
|
3163 | * @see _.forOwn
|
3164 | **/
|
3165 | forOwn<T extends {}>(
|
3166 | callback: ObjectIterator<T, void>,
|
3167 | thisArg?: any): _.LoDashObjectWrapper<T>;
|
3168 | }
|
3169 |
|
3170 | //_.forOwnRight
|
3171 | interface LoDashStatic {
|
3172 | /**
|
3173 | * This method is like _.forOwn except that it iterates over elements of a collection in the
|
3174 | * opposite order.
|
3175 | * @param object The object to iterate over.
|
3176 | * @param callback The function called per iteration.
|
3177 | * @param thisArg The this binding of callback.
|
3178 | * @return object
|
3179 | **/
|
3180 | forOwnRight<T extends {}>(
|
3181 | object: Dictionary<T>,
|
3182 | callback?: ObjectIterator<T, void>,
|
3183 | thisArg?: any): Dictionary<T>;
|
3184 | }
|
3185 |
|
3186 | interface LoDashObjectWrapper<T> {
|
3187 | /**
|
3188 | * @see _.forOwnRight
|
3189 | **/
|
3190 | forOwnRight<T extends {}>(
|
3191 | callback: ObjectIterator<T, void>,
|
3192 | thisArg?: any): _.LoDashObjectWrapper<T>;
|
3193 | }
|
3194 |
|
3195 | //_.functions
|
3196 | interface LoDashStatic {
|
3197 | /**
|
3198 | * Creates a sorted array of property names of all enumerable properties, own and inherited, of
|
3199 | * object that have function values.
|
3200 | * @param object The object to inspect.
|
3201 | * @return An array of property names that have function values.
|
3202 | **/
|
3203 | functions(object: any): string[];
|
3204 |
|
3205 | /**
|
3206 | * @see _functions
|
3207 | **/
|
3208 | methods(object: any): string[];
|
3209 | }
|
3210 |
|
3211 | interface LoDashObjectWrapper<T> {
|
3212 | /**
|
3213 | * @see _.functions
|
3214 | **/
|
3215 | functions(): _.LoDashArrayWrapper<string>;
|
3216 |
|
3217 | /**
|
3218 | * @see _.functions
|
3219 | **/
|
3220 | methods(): _.LoDashArrayWrapper<string>;
|
3221 | }
|
3222 |
|
3223 | //_.has
|
3224 | interface LoDashStatic {
|
3225 | /**
|
3226 | * Checks if the specified object property exists and is a direct property, instead of an
|
3227 | * inherited property.
|
3228 | * @param object The object to check.
|
3229 | * @param property The property to check for.
|
3230 | * @return True if key is a direct property, else false.
|
3231 | **/
|
3232 | has(object: any, property: string): boolean;
|
3233 | }
|
3234 |
|
3235 | //_.invert
|
3236 | interface LoDashStatic {
|
3237 | /**
|
3238 | * Creates an object composed of the inverted keys and values of the given object.
|
3239 | * @param object The object to invert.
|
3240 | * @return The created inverted object.
|
3241 | **/
|
3242 | invert(object: any): any;
|
3243 | }
|
3244 |
|
3245 | //_.isArguments
|
3246 | interface LoDashStatic {
|
3247 | /**
|
3248 | * Checks if value is an arguments object.
|
3249 | * @param value The value to check.
|
3250 | * @return True if the value is an arguments object, else false.
|
3251 | **/
|
3252 | isArguments(value: any): boolean;
|
3253 | }
|
3254 |
|
3255 | //_.isArray
|
3256 | interface LoDashStatic {
|
3257 | /**
|
3258 | * Checks if value is an array.
|
3259 | * @param value The value to check.
|
3260 | * @return True if the value is an array, else false.
|
3261 | **/
|
3262 | isArray(value: any): boolean;
|
3263 | }
|
3264 |
|
3265 | //_.isBoolean
|
3266 | interface LoDashStatic {
|
3267 | /**
|
3268 | * Checks if value is a boolean value.
|
3269 | * @param value The value to check.
|
3270 | * @return True if the value is a boolean value, else false.
|
3271 | **/
|
3272 | isBoolean(value: any): boolean;
|
3273 | }
|
3274 |
|
3275 | //_.isDate
|
3276 | interface LoDashStatic {
|
3277 | /**
|
3278 | * Checks if value is a date.
|
3279 | * @param value The value to check.
|
3280 | * @return True if the value is a date, else false.
|
3281 | **/
|
3282 | isDate(value: any): boolean;
|
3283 | }
|
3284 |
|
3285 | //_.isElement
|
3286 | interface LoDashStatic {
|
3287 | /**
|
3288 | * Checks if value is a DOM element.
|
3289 | * @param value The value to check.
|
3290 | * @return True if the value is a DOM element, else false.
|
3291 | **/
|
3292 | isElement(value: any): boolean;
|
3293 | }
|
3294 |
|
3295 | //_.isEmpty
|
3296 | interface LoDashStatic {
|
3297 | /**
|
3298 | * Checks if value is empty. Arrays, strings, or arguments objects with a length of 0 and objects
|
3299 | * with no own enumerable properties are considered "empty".
|
3300 | * @param value The value to inspect.
|
3301 | * @return True if the value is empty, else false.
|
3302 | **/
|
3303 | isEmpty(value: any[]): boolean;
|
3304 |
|
3305 | /**
|
3306 | * @see _.isEmpty
|
3307 | **/
|
3308 | isEmpty(value: Dictionary<any>): boolean;
|
3309 |
|
3310 | /**
|
3311 | * @see _.isEmpty
|
3312 | **/
|
3313 | isEmpty(value: string): boolean;
|
3314 |
|
3315 | /**
|
3316 | * @see _.isEmpty
|
3317 | **/
|
3318 | isEmpty(value: any): boolean;
|
3319 | }
|
3320 |
|
3321 | //_.isEqual
|
3322 | interface LoDashStatic {
|
3323 | /**
|
3324 | * Performs a deep comparison between two values to determine if they are equivalent to each
|
3325 | * other. If a callback is provided it will be executed to compare values. If the callback
|
3326 | * returns undefined comparisons will be handled by the method instead. The callback is bound to
|
3327 | * thisArg and invoked with two arguments; (a, b).
|
3328 | * @param a The value to compare.
|
3329 | * @param b The other value to compare.
|
3330 | * @param callback The function to customize comparing values.
|
3331 | * @param thisArg The this binding of callback.
|
3332 | * @return True if the values are equivalent, else false.
|
3333 | **/
|
3334 | isEqual(
|
3335 | a: any,
|
3336 | b: any,
|
3337 | callback?: (a: any, b: any) => boolean,
|
3338 | thisArg?: any): boolean;
|
3339 | }
|
3340 |
|
3341 | //_.isFinite
|
3342 | interface LoDashStatic {
|
3343 | /**
|
3344 | * Checks if value is, or can be coerced to, a finite number.
|
3345 | *
|
3346 | * Note: This is not the same as native isFinite which will return true for booleans and empty
|
3347 | * strings. See http://es5.github.io/#x15.1.2.5.
|
3348 | * @param value The value to check.
|
3349 | * @return True if the value is finite, else false.
|
3350 | **/
|
3351 | isFinite(value: any): boolean;
|
3352 | }
|
3353 |
|
3354 | //_.isFunction
|
3355 | interface LoDashStatic {
|
3356 | /**
|
3357 | * Checks if value is a function.
|
3358 | * @param value The value to check.
|
3359 | * @return True if the value is a function, else false.
|
3360 | **/
|
3361 | isFunction(value: any): boolean;
|
3362 | }
|
3363 |
|
3364 | //_.isNaN
|
3365 | interface LoDashStatic {
|
3366 | /**
|
3367 | * Checks if value is NaN.
|
3368 | *
|
3369 | * Note: This is not the same as native isNaN which will return true for undefined and other
|
3370 | * non-numeric values. See http://es5.github.io/#x15.1.2.4.
|
3371 | * @param value The value to check.
|
3372 | * @return True if the value is NaN, else false.
|
3373 | **/
|
3374 | isNaN(value: any): boolean;
|
3375 | }
|
3376 |
|
3377 | //_.isNull
|
3378 | interface LoDashStatic {
|
3379 | /**
|
3380 | * Checks if value is null.
|
3381 | * @param value The value to check.
|
3382 | * @return True if the value is null, else false.
|
3383 | **/
|
3384 | isNull(value: any): boolean;
|
3385 | }
|
3386 |
|
3387 | //_.isNumber
|
3388 | interface LoDashStatic {
|
3389 | /**
|
3390 | * Checks if value is a number.
|
3391 | *
|
3392 | * Note: NaN is considered a number. See http://es5.github.io/#x8.5.
|
3393 | * @param value The value to check.
|
3394 | * @return True if the value is a number, else false.
|
3395 | **/
|
3396 | isNumber(value: any): boolean;
|
3397 | }
|
3398 |
|
3399 | //_.isObject
|
3400 | interface LoDashStatic {
|
3401 | /**
|
3402 | * Checks if value is the language type of Object. (e.g. arrays, functions, objects, regexes,
|
3403 | * new Number(0), and new String(''))
|
3404 | * @param value The value to check.
|
3405 | * @return True if the value is an object, else false.
|
3406 | **/
|
3407 | isObject(value: any): boolean;
|
3408 | }
|
3409 |
|
3410 | //_.isPlainObject
|
3411 | interface LoDashStatic {
|
3412 | /**
|
3413 | * Checks if value is an object created by the Object constructor.
|
3414 | * @param value The value to check.
|
3415 | * @return True if value is a plain object, else false.
|
3416 | **/
|
3417 | isPlainObject(value: any): boolean;
|
3418 | }
|
3419 |
|
3420 | //_.isRegExp
|
3421 | interface LoDashStatic {
|
3422 | /**
|
3423 | * Checks if value is a regular expression.
|
3424 | * @param value The value to check.
|
3425 | * @return True if the value is a regular expression, else false.
|
3426 | **/
|
3427 | isRegExp(value: any): boolean;
|
3428 | }
|
3429 |
|
3430 | //_.isString
|
3431 | interface LoDashStatic {
|
3432 | /**
|
3433 | * Checks if value is a string.
|
3434 | * @param value The value to check.
|
3435 | * @return True if the value is a string, else false.
|
3436 | **/
|
3437 | isString(value: any): boolean;
|
3438 | }
|
3439 |
|
3440 | //_.isUndefined
|
3441 | interface LoDashStatic {
|
3442 | /**
|
3443 | * Checks if value is undefined.
|
3444 | * @param value The value to check.
|
3445 | * @return True if the value is undefined, else false.
|
3446 | **/
|
3447 | isUndefined(value: any): boolean;
|
3448 | }
|
3449 |
|
3450 | //_.keys
|
3451 | interface LoDashStatic {
|
3452 | /**
|
3453 | * Creates an array composed of the own enumerable property names of an object.
|
3454 | * @param object The object to inspect.
|
3455 | * @return An array of property names.
|
3456 | **/
|
3457 | keys(object: any): string[];
|
3458 | }
|
3459 |
|
3460 | //_.mapValues
|
3461 | interface LoDashStatic {
|
3462 | /**
|
3463 | * Creates an object with the same keys as object and values generated by running each own
|
3464 | * enumerable property of object through the callback. The callback is bound to thisArg and
|
3465 | * invoked with three arguments; (value, key, object).
|
3466 | *
|
3467 | * If a property name is provided for callback the created "_.pluck" style callback will return
|
3468 | * the property value of the given element.
|
3469 | *
|
3470 | * If an object is provided for callback the created "_.where" style callback will return true
|
3471 | * for elements that have the properties of the given object, else false.
|
3472 | *
|
3473 | * @param object The object to iterate over.
|
3474 | * @param callback The function called per iteration.
|
3475 | * @param thisArg `this` object in `iterator`, optional.
|
3476 | * @return Returns a new object with values of the results of each callback execution.
|
3477 | */
|
3478 | mapValues<T, TResult>(obj: Dictionary<T>, callback: ObjectIterator<T, TResult>, thisArg?: any): Dictionary<TResult>;
|
3479 | mapValues<T>(obj: Dictionary<T>, where: Dictionary<T>): Dictionary<boolean>;
|
3480 | mapValues<T, TMapped>(obj: T, pluck: string): TMapped;
|
3481 | mapValues<T>(obj: T, callback: ObjectIterator<any, any>, thisArg?: any): T;
|
3482 | }
|
3483 |
|
3484 | //_.merge
|
3485 | interface LoDashStatic {
|
3486 | /**
|
3487 | * Recursively merges own enumerable properties of the source object(s), that don't resolve
|
3488 | * to undefined into the destination object. Subsequent sources will overwrite property
|
3489 | * assignments of previous sources. If a callback is provided it will be executed to produce
|
3490 | * the merged values of the destination and source properties. If the callback returns undefined
|
3491 | * merging will be handled by the method instead. The callback is bound to thisArg and invoked
|
3492 | * with two arguments; (objectValue, sourceValue).
|
3493 | * @param object The destination object.
|
3494 | * @param s1-8 The source object(s)
|
3495 | * @param callback The function to customize merging properties.
|
3496 | * @param thisArg The this binding of callback.
|
3497 | * @return The destination object.
|
3498 | **/
|
3499 | merge<P, T, S1, Value, Result>(
|
3500 | object: T,
|
3501 | s1: S1,
|
3502 | callback?: (objectValue: Value, sourceValue: Value) => Value,
|
3503 | thisArg?: any): Result;
|
3504 |
|
3505 | /**
|
3506 | * @see _.merge
|
3507 | **/
|
3508 | merge<P, T, S1, S2, Value, Result>(
|
3509 | object: T,
|
3510 | s1: S1,
|
3511 | s2: S2,
|
3512 | callback?: (objectValue: Value, sourceValue: Value) => Value,
|
3513 | thisArg?: any): Result;
|
3514 |
|
3515 | /**
|
3516 | * @see _.merge
|
3517 | **/
|
3518 | merge<P, T, S1, S2, S3, Value, Result>(
|
3519 | object: T,
|
3520 | s1: S1,
|
3521 | s2: S2,
|
3522 | s3: S3,
|
3523 | callback?: (objectValue: Value, sourceValue: Value) => Value,
|
3524 | thisArg?: any): Result;
|
3525 |
|
3526 | /**
|
3527 | * @see _.merge
|
3528 | **/
|
3529 | merge<P, T, S1, S2, S3, S4, Value, Result>(
|
3530 | object: T,
|
3531 | s1: S1,
|
3532 | s2: S2,
|
3533 | s3: S3,
|
3534 | s4: S4,
|
3535 | callback?: (objectValue: Value, sourceValue: Value) => Value,
|
3536 | thisArg?: any): Result;
|
3537 | }
|
3538 |
|
3539 | //_.omit
|
3540 | interface LoDashStatic {
|
3541 | /**
|
3542 | * Creates a shallow clone of object excluding the specified properties. Property names may be
|
3543 | * specified as individual arguments or as arrays of property names. If a callback is provided
|
3544 | * it will be executed for each property of object omitting the properties the callback returns
|
3545 | * truey for. The callback is bound to thisArg and invoked with three arguments; (value, key,
|
3546 | * object).
|
3547 | * @param object The source object.
|
3548 | * @param keys The properties to omit.
|
3549 | * @return An object without the omitted properties.
|
3550 | **/
|
3551 | omit<Omitted, T>(
|
3552 | object: T,
|
3553 | ...keys: string[]): Omitted;
|
3554 |
|
3555 | /**
|
3556 | * @see _.omit
|
3557 | **/
|
3558 | omit<Omitted, T>(
|
3559 | object: T,
|
3560 | keys: string[]): Omitted;
|
3561 |
|
3562 | /**
|
3563 | * @see _.omit
|
3564 | **/
|
3565 | omit<Omitted, T>(
|
3566 | object: T,
|
3567 | callback: ObjectIterator<any, boolean>,
|
3568 | thisArg?: any): Omitted;
|
3569 | }
|
3570 |
|
3571 | //_.pairs
|
3572 | interface LoDashStatic {
|
3573 | /**
|
3574 | * Creates a two dimensional array of an object’s key-value pairs,
|
3575 | * i.e. [[key1, value1], [key2, value2]].
|
3576 | * @param object The object to inspect.
|
3577 | * @return Aew array of key-value pairs.
|
3578 | **/
|
3579 | pairs(object: any): any[][];
|
3580 | }
|
3581 |
|
3582 | //_.picks
|
3583 | interface LoDashStatic {
|
3584 | /**
|
3585 | * Creates a shallow clone of object composed of the specified properties. Property names may be
|
3586 | * specified as individual arguments or as arrays of property names. If a callback is provided
|
3587 | * it will be executed for each property of object picking the properties the callback returns
|
3588 | * truey for. The callback is bound to thisArg and invoked with three arguments; (value, key,
|
3589 | * object).
|
3590 | * @param object Object to strip unwanted key/value pairs.
|
3591 | * @param keys Property names to pick
|
3592 | * @return An object composed of the picked properties.
|
3593 | **/
|
3594 | pick<Picked, T>(
|
3595 | object: T,
|
3596 | ...keys: string[]): Picked;
|
3597 |
|
3598 | /**
|
3599 | * @see _.pick
|
3600 | **/
|
3601 | pick<Picked, T>(
|
3602 | object: T,
|
3603 | keys: string[]): Picked;
|
3604 |
|
3605 | /**
|
3606 | * @see _.pick
|
3607 | **/
|
3608 | pick<Picked, T>(
|
3609 | object: T,
|
3610 | callback: ObjectIterator<any, boolean>,
|
3611 | thisArg?: any): Picked;
|
3612 | }
|
3613 |
|
3614 | //_.transform
|
3615 | interface LoDashStatic {
|
3616 | /**
|
3617 | * An alternative to _.reduce this method transforms object to a new accumulator object which is
|
3618 | * the result of running each of its elements through a callback, with each callback execution
|
3619 | * potentially mutating the accumulator object. The callback is bound to thisArg and invoked with
|
3620 | * four arguments; (accumulator, value, key, object). Callbacks may exit iteration early by
|
3621 | * explicitly returning false.
|
3622 | * @param collection The collection to iterate over.
|
3623 | * @param callback The function called per iteration.
|
3624 | * @param accumulator The custom accumulator value.
|
3625 | * @param thisArg The this binding of callback.
|
3626 | * @return The accumulated value.
|
3627 | **/
|
3628 | transform<T, Acc>(
|
3629 | collection: Collection<T>,
|
3630 | callback: MemoVoidIterator<T, Acc>,
|
3631 | accumulator: Acc,
|
3632 | thisArg?: any): Acc;
|
3633 |
|
3634 | /**
|
3635 | * @see _.transform
|
3636 | **/
|
3637 | transform<T, Acc>(
|
3638 | collection: Collection<T>,
|
3639 | callback?: MemoVoidIterator<T, Acc>,
|
3640 | thisArg?: any): Acc;
|
3641 | }
|
3642 |
|
3643 | //_.values
|
3644 | interface LoDashStatic {
|
3645 | /**
|
3646 | * Creates an array composed of the own enumerable property values of object.
|
3647 | * @param object The object to inspect.
|
3648 | * @return Returns an array of property values.
|
3649 | **/
|
3650 | values(object: any): any[];
|
3651 | }
|
3652 |
|
3653 | /*************
|
3654 | * Utilities *
|
3655 | *************/
|
3656 | //_.escape
|
3657 | interface LoDashStatic {
|
3658 | /**
|
3659 | * Converts the characters &, <, >, ", and ' in string to their corresponding HTML entities.
|
3660 | * @param string The string to escape.
|
3661 | * @return The escaped string.
|
3662 | **/
|
3663 | escape(str: string): string;
|
3664 | }
|
3665 |
|
3666 | //_.identity
|
3667 | interface LoDashStatic {
|
3668 | /**
|
3669 | * This method returns the first argument provided to it.
|
3670 | * @param value Any value.
|
3671 | * @return value.
|
3672 | **/
|
3673 | identity<T>(value: T): T;
|
3674 | }
|
3675 |
|
3676 | //_.mixin
|
3677 | interface LoDashStatic {
|
3678 | /**
|
3679 | * Adds function properties of a source object to the lodash function and chainable wrapper.
|
3680 | * @param object The object of function properties to add to lodash.
|
3681 | **/
|
3682 | mixin(object: Dictionary<(value: any) => any>): void;
|
3683 | }
|
3684 |
|
3685 | //_.noConflict
|
3686 | interface LoDashStatic {
|
3687 | /**
|
3688 | * Reverts the '_' variable to its previous value and returns a reference to the lodash function.
|
3689 | * @return The lodash function.
|
3690 | **/
|
3691 | noConflict(): typeof _;
|
3692 | }
|
3693 |
|
3694 | //_.parseInt
|
3695 | interface LoDashStatic {
|
3696 | /**
|
3697 | * Converts the given value into an integer of the specified radix. If radix is undefined or 0 a
|
3698 | * radix of 10 is used unless the value is a hexadecimal, in which case a radix of 16 is used.
|
3699 | *
|
3700 | * Note: This method avoids differences in native ES3 and ES5 parseInt implementations. See
|
3701 | * http://es5.github.io/#E.
|
3702 | * @param value The value to parse.
|
3703 | * @param radix The radix used to interpret the value to parse.
|
3704 | * @return The new integer value.
|
3705 | **/
|
3706 | parseInt(value: string): number;
|
3707 | }
|
3708 |
|
3709 | //_.random
|
3710 | interface LoDashStatic {
|
3711 | /**
|
3712 | * Produces a random number between min and max (inclusive). If only one argument is provided a
|
3713 | * number between 0 and the given number will be returned. If floating is truey or either min or
|
3714 | * max are floats a floating-point number will be returned instead of an integer.
|
3715 | * @param max The maximum possible value.
|
3716 | * @param floating Specify returning a floating-point number.
|
3717 | * @return A random number.
|
3718 | **/
|
3719 | random(max: number, floating?: boolean): number;
|
3720 |
|
3721 | /**
|
3722 | * @see _.random
|
3723 | * @param min The minimum possible value.
|
3724 | * @return A random number between `min` and `max`.
|
3725 | **/
|
3726 | random(min: number, max: number, floating?: boolean): number;
|
3727 | }
|
3728 |
|
3729 | //_.result
|
3730 | interface LoDashStatic {
|
3731 | /**
|
3732 | * Resolves the value of property on object. If property is a function it will be invoked with
|
3733 | * the this binding of object and its result returned, else the property value is returned. If
|
3734 | * object is falsey then undefined is returned.
|
3735 | * @param object The object to inspect.
|
3736 | * @param property The property to get the value of.
|
3737 | * @return The resolved value.
|
3738 | **/
|
3739 | result(object: any, property: string): any;
|
3740 | }
|
3741 |
|
3742 | //_.runInContext
|
3743 | interface LoDashStatic {
|
3744 | /**
|
3745 | * Create a new lodash function using the given context object.
|
3746 | * @param context The context object
|
3747 | * @returns The lodash function.
|
3748 | **/
|
3749 | runInContext(context: any): typeof _;
|
3750 | }
|
3751 |
|
3752 | //_.template
|
3753 | interface LoDashStatic {
|
3754 | /**
|
3755 | * A micro-templating method that handles arbitrary delimiters, preserves whitespace, and
|
3756 | * correctly escapes quotes within interpolated code.
|
3757 | *
|
3758 | * Note: In the development build, _.template utilizes sourceURLs for easier debugging. See
|
3759 | * http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl
|
3760 | *
|
3761 | * For more information on precompiling templates see:
|
3762 | * http://lodash.com/#custom-builds
|
3763 | *
|
3764 | * For more information on Chrome extension sandboxes see:
|
3765 | * http://developer.chrome.com/stable/extensions/sandboxingEval.html
|
3766 | * @param text The template text.
|
3767 | * @param data The data object used to populate the text.
|
3768 | * @param options The options object.
|
3769 | * @param options.escape The "escape" delimiter.
|
3770 | * @param options.evaluate The "evaluate" delimiter.
|
3771 | * @param options.import An object to import into the template as local variables.
|
3772 | * @param options.interpolate The "interpolate" delimiter.
|
3773 | * @param sourceURL The sourceURL of the template’s compiled source.
|
3774 | * @param variable The data object variable name.
|
3775 | * @return Returns the compiled Lo-Dash HTML template or a TemplateExecutor if no data is passed.
|
3776 | **/
|
3777 | template(
|
3778 | text: string): TemplateExecutor;
|
3779 |
|
3780 | /**
|
3781 | * @see _.template
|
3782 | **/
|
3783 | template(
|
3784 | text: string,
|
3785 | data: any,
|
3786 | options?: TemplateSettings,
|
3787 | sourceURL?: string,
|
3788 | variable?: string): any /* string or TemplateExecutor*/;
|
3789 | }
|
3790 |
|
3791 | interface TemplateExecutor {
|
3792 | (...data: any[]): string;
|
3793 | source: string;
|
3794 | }
|
3795 |
|
3796 | //_.times
|
3797 | interface LoDashStatic {
|
3798 | /**
|
3799 | * Executes the callback n times, returning an array of the results of each callback execution.
|
3800 | * The callback is bound to thisArg and invoked with one argument; (index).
|
3801 | * @param n The number of times to execute the callback.
|
3802 | * @param callback The function called per iteration.
|
3803 | * @param thisArg The this binding of callback.
|
3804 | **/
|
3805 | times<TResult>(
|
3806 | n: number,
|
3807 | callback: (num: number) => TResult,
|
3808 | context?: any): TResult[];
|
3809 | }
|
3810 |
|
3811 | //_.unescape
|
3812 | interface LoDashStatic {
|
3813 | /**
|
3814 | * The inverse of _.escape this method converts the HTML entities &, <, >, ", and
|
3815 | * ' in string to their corresponding characters.
|
3816 | * @param string The string to unescape.
|
3817 | * @return The unescaped string.
|
3818 | **/
|
3819 | unescape(
|
3820 | string: string): string;
|
3821 | }
|
3822 |
|
3823 | //_.uniqueId
|
3824 | interface LoDashStatic {
|
3825 | /**
|
3826 | * Generates a unique ID. If prefix is provided the ID will be appended to it.
|
3827 | * @param prefix The value to prefix the ID with.
|
3828 | * @return Returns the unique ID.
|
3829 | **/
|
3830 | uniqueId(prefix?: string): string;
|
3831 | }
|
3832 |
|
3833 | interface ListIterator<T, TResult> {
|
3834 | (value: T, index: number, list: T[]): TResult;
|
3835 | }
|
3836 |
|
3837 | interface ObjectIterator<T, TResult> {
|
3838 | (element: T, key: string, list: any): TResult;
|
3839 | }
|
3840 |
|
3841 | interface MemoVoidIterator<T, TResult> {
|
3842 | (prev: TResult, curr: T, indexOrKey: any, list?: T[]): void;
|
3843 | }
|
3844 | interface MemoIterator<T, TResult> {
|
3845 | (prev: TResult, curr: T, indexOrKey: any, list?: T[]): TResult;
|
3846 | }
|
3847 | /*
|
3848 | interface MemoListIterator<T, TResult> {
|
3849 | (prev: TResult, curr: T, index: number, list?: T[]): TResult;
|
3850 | }
|
3851 | interface MemoObjectIterator<T, TResult> {
|
3852 | (prev: TResult, curr: T, index: string, object?: Dictionary<T>): TResult;
|
3853 | }
|
3854 | */
|
3855 |
|
3856 | interface Collection<T> { }
|
3857 |
|
3858 | // Common interface between Arrays and jQuery objects
|
3859 | interface List<T> extends Collection<T> {
|
3860 | [index: number]: T;
|
3861 | length: number;
|
3862 | }
|
3863 |
|
3864 | interface Dictionary<T> extends Collection<T> {
|
3865 | [index: string]: T;
|
3866 | }
|
3867 | }
|
3868 |
|
3869 | declare module "lodash" {
|
3870 | export = _;
|
3871 | } |
\ | No newline at end of file |