PageRenderTime 54ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 1ms

/src/Merchello.Web.UI/Scripts/typings/underscore/underscore.d.ts

https://github.com/vokseverk/Merchello
TypeScript Typings | 2979 lines | 653 code | 434 blank | 1892 comment | 3 complexity | f3cd66d81cfd9b30ae8e7a9563a7d932 MD5 | raw file
Possible License(s): MIT, CC-BY-SA-3.0

Large files files are truncated, but you can click here to view the full file

  1. // Type definitions for Underscore 1.5.2
  2. // Project: http://underscorejs.org/
  3. // Definitions by: Boris Yankov <https://github.com/borisyankov/>
  4. // Definitions by: Josh Baldwin <https://github.com/jbaldwin/>
  5. // Definitions: https://github.com/borisyankov/DefinitelyTyped
  6. declare module _ {
  7. /**
  8. * underscore.js _.throttle options.
  9. **/
  10. interface ThrottleSettings {
  11. /**
  12. * If you'd like to disable the leading-edge call, pass this as false.
  13. **/
  14. leading?: boolean;
  15. /**
  16. * If you'd like to disable the execution on the trailing-edge, pass false.
  17. **/
  18. trailing?: boolean;
  19. }
  20. /**
  21. * underscore.js template settings, set templateSettings or pass as an argument
  22. * to 'template()' to overide defaults.
  23. **/
  24. interface TemplateSettings {
  25. /**
  26. * Default value is '/<%([\s\S]+?)%>/g'.
  27. **/
  28. evaluate?: RegExp;
  29. /**
  30. * Default value is '/<%=([\s\S]+?)%>/g'.
  31. **/
  32. interpolate?: RegExp;
  33. /**
  34. * Default value is '/<%-([\s\S]+?)%>/g'.
  35. **/
  36. escape?: RegExp;
  37. }
  38. interface ListIterator<T, TResult> {
  39. (value: T, index: number, list: T[]): TResult;
  40. }
  41. interface ObjectIterator<T, TResult> {
  42. (element: T, key: string, list: any): TResult;
  43. }
  44. interface MemoIterator<T, TResult> {
  45. (prev: TResult, curr: T, index: number, list: T[]): TResult;
  46. }
  47. interface Collection<T> { }
  48. // Common interface between Arrays and jQuery objects
  49. interface List<T> extends Collection<T> {
  50. [index: number]: T;
  51. length: number;
  52. }
  53. interface Dictionary<T> extends Collection<T> {
  54. [index: string]: T;
  55. }
  56. }
  57. interface UnderscoreStatic {
  58. /**
  59. * Underscore OOP Wrapper, all Underscore functions that take an object
  60. * as the first parameter can be invoked through this function.
  61. * @param key First argument to Underscore object functions.
  62. **/
  63. <T>(value: Array<T>): Underscore<T>;
  64. <T>(value: T): Underscore<T>;
  65. /* *************
  66. * Collections *
  67. ************* */
  68. /**
  69. * Iterates over a list of elements, yielding each in turn to an iterator function. The iterator is
  70. * bound to the context object, if one is passed. Each invocation of iterator is called with three
  71. * arguments: (element, index, list). If list is a JavaScript object, iterator's arguments will be
  72. * (value, key, object). Delegates to the native forEach function if it exists.
  73. * @param list Iterates over this list of elements.
  74. * @param iterator Iterator function for each element `list`.
  75. * @param context 'this' object in `iterator`, optional.
  76. **/
  77. each<T>(
  78. list: _.List<T>,
  79. iterator: _.ListIterator<T, void>,
  80. context?: any): void;
  81. /**
  82. * @see _.each
  83. * @param object Iterators over this object's properties.
  84. * @param iterator Iterator function for each property on `obj`.
  85. * @param context 'this' object in `iterator`, optional.
  86. **/
  87. each<T>(
  88. object: _.Dictionary<T>,
  89. iterator: _.ObjectIterator<T, void>,
  90. context?: any): void;
  91. /**
  92. * @see _.each
  93. **/
  94. forEach<T>(
  95. list: _.List<T>,
  96. iterator: _.ListIterator<T, void >,
  97. context?: any): void;
  98. /**
  99. * @see _.each
  100. **/
  101. forEach<T>(
  102. object: _.Dictionary<T>,
  103. iterator: _.ObjectIterator<T, void >,
  104. context?: any): void;
  105. /**
  106. * Produces a new array of values by mapping each value in list through a transformation function
  107. * (iterator). If the native map method exists, it will be used instead. If list is a JavaScript
  108. * object, iterator's arguments will be (value, key, object).
  109. * @param list Maps the elements of this array.
  110. * @param iterator Map iterator function for each element in `list`.
  111. * @param context `this` object in `iterator`, optional.
  112. * @return The mapped array result.
  113. **/
  114. map<T, TResult>(
  115. list: _.List<T>,
  116. iterator: _.ListIterator<T, TResult>,
  117. context?: any): TResult[];
  118. /**
  119. * @see _.map
  120. * @param object Maps the properties of this object.
  121. * @param iterator Map iterator function for each property on `obj`.
  122. * @param context `this` object in `iterator`, optional.
  123. * @return The mapped object result.
  124. **/
  125. map<T, TResult>(
  126. object: _.Dictionary<T>,
  127. iterator: _.ObjectIterator<T, TResult>,
  128. context?: any): TResult[];
  129. /**
  130. * @see _.map
  131. **/
  132. collect<T, TResult>(
  133. list: _.List<T>, iterator:
  134. _.ListIterator<T, TResult>,
  135. context?: any): TResult[];
  136. /**
  137. * @see _.map
  138. **/
  139. collect<T, TResult>(
  140. object: _.Dictionary<T>,
  141. iterator: _.ObjectIterator<T, TResult>,
  142. context?: any): TResult[];
  143. /**
  144. * Also known as inject and foldl, reduce boils down a list of values into a single value.
  145. * Memo is the initial state of the reduction, and each successive step of it should be
  146. * returned by iterator. The iterator is passed four arguments: the memo, then the value
  147. * and index (or key) of the iteration, and finally a reference to the entire list.
  148. * @param list Reduces the elements of this array.
  149. * @param iterator Reduce iterator function for each element in `list`.
  150. * @param memo Initial reduce state.
  151. * @param context `this` object in `iterator`, optional.
  152. * @return Reduced object result.
  153. **/
  154. reduce<T, TResult>(
  155. list: _.Collection<T>,
  156. iterator: _.MemoIterator<T, TResult>,
  157. memo?: TResult,
  158. context?: any): TResult;
  159. /**
  160. * @see _.reduce
  161. **/
  162. inject<T, TResult>(
  163. list: _.Collection<T>,
  164. iterator: _.MemoIterator<T, TResult>,
  165. memo?: TResult,
  166. context?: any): TResult;
  167. /**
  168. * @see _.reduce
  169. **/
  170. foldl<T, TResult>(
  171. list: _.Collection<T>,
  172. iterator: _.MemoIterator<T, TResult>,
  173. memo?: TResult,
  174. context?: any): TResult;
  175. /**
  176. * The right-associative version of reduce. Delegates to the JavaScript 1.8 version of
  177. * reduceRight, if it exists. Foldr is not as useful in JavaScript as it would be in a
  178. * language with lazy evaluation.
  179. * @param list Reduces the elements of this array.
  180. * @param iterator Reduce iterator function for each element in `list`.
  181. * @param memo Initial reduce state.
  182. * @param context `this` object in `iterator`, optional.
  183. * @return Reduced object result.
  184. **/
  185. reduceRight<T, TResult>(
  186. list: _.Collection<T>,
  187. iterator: _.MemoIterator<T, TResult>,
  188. memo?: TResult,
  189. context?: any): TResult;
  190. /**
  191. * @see _.reduceRight
  192. **/
  193. foldr<T, TResult>(
  194. list: _.Collection<T>,
  195. iterator: _.MemoIterator<T, TResult>,
  196. memo?: TResult,
  197. context?: any): TResult;
  198. /**
  199. * Looks through each value in the list, returning the first one that passes a truth
  200. * test (iterator). The function returns as soon as it finds an acceptable element,
  201. * and doesn't traverse the entire list.
  202. * @param list Searches for a value in this list.
  203. * @param iterator Search iterator function for each element in `list`.
  204. * @param context `this` object in `iterator`, optional.
  205. * @return The first acceptable found element in `list`, if nothing is found undefined/null is returned.
  206. **/
  207. find<T>(
  208. list: _.Collection<T>,
  209. iterator: _.ListIterator<T, boolean>,
  210. context?: any): T;
  211. /**
  212. * @see _.find
  213. **/
  214. detect<T>(
  215. list: _.Collection<T>,
  216. iterator: _.ListIterator<T, boolean>,
  217. context?: any): T;
  218. /**
  219. * Looks through each value in the list, returning an array of all the values that pass a truth
  220. * test (iterator). Delegates to the native filter method, if it exists.
  221. * @param list Filter elements out of this list.
  222. * @param iterator Filter iterator function for each element in `list`.
  223. * @param context `this` object in `iterator`, optional.
  224. * @return The filtered list of elements.
  225. **/
  226. filter<T>(
  227. list: _.Collection<T>,
  228. iterator: _.ListIterator<T, boolean>,
  229. context?: any): T[];
  230. /**
  231. * @see _.filter
  232. **/
  233. select<T>(
  234. list: _.Collection<T>,
  235. iterator: _.ListIterator<T, boolean>,
  236. context?: any): T[];
  237. /**
  238. * Looks through each value in the list, returning an array of all the values that contain all
  239. * of the key-value pairs listed in properties.
  240. * @param list List to match elements again `properties`.
  241. * @param properties The properties to check for on each element within `list`.
  242. * @return The elements within `list` that contain the required `properties`.
  243. **/
  244. where<T, U extends {}>(
  245. list: _.Collection<T>,
  246. properties: U): T[];
  247. /**
  248. * Looks through the list and returns the first value that matches all of the key-value pairs listed in properties.
  249. * @param list Search through this list's elements for the first object with all `properties`.
  250. * @param properties Properties to look for on the elements within `list`.
  251. * @return The first element in `list` that has all `properties`.
  252. **/
  253. findWhere<T, U extends {}>(
  254. list: _.List<T>,
  255. properties: U): T;
  256. /**
  257. * Returns the values in list without the elements that the truth test (iterator) passes.
  258. * The opposite of filter.
  259. * Return all the elements for which a truth test fails.
  260. * @param list Reject elements within this list.
  261. * @param iterator Reject iterator function for each element in `list`.
  262. * @param context `this` object in `iterator`, optional.
  263. * @return The rejected list of elements.
  264. **/
  265. reject<T>(
  266. list: _.Collection<T>,
  267. iterator: _.ListIterator<T, boolean>,
  268. context?: any): T[];
  269. /**
  270. * Returns true if all of the values in the list pass the iterator truth test. Delegates to the
  271. * native method every, if present.
  272. * @param list Truth test against all elements within this list.
  273. * @param iterator Trust test iterator function for each element in `list`.
  274. * @param context `this` object in `iterator`, optional.
  275. * @return True if all elements passed the truth test, otherwise false.
  276. **/
  277. every<T>(
  278. list: _.Collection<T>,
  279. iterator?: _.ListIterator<T, boolean>,
  280. context?: any): boolean;
  281. /**
  282. * @see _.all
  283. **/
  284. all<T>(
  285. list: _.Collection<T>,
  286. iterator?: _.ListIterator<T, boolean>,
  287. context?: any): boolean;
  288. /**
  289. * Returns true if any of the values in the list pass the iterator truth test. Short-circuits and
  290. * stops traversing the list if a true element is found. Delegates to the native method some, if present.
  291. * @param list Truth test against all elements within this list.
  292. * @param iterator Trust test iterator function for each element in `list`.
  293. * @param context `this` object in `iterator`, optional.
  294. * @return True if any elements passed the truth test, otherwise false.
  295. **/
  296. any<T>(
  297. list: _.Collection<T>,
  298. iterator?: _.ListIterator<T, boolean>,
  299. context?: any): boolean;
  300. /**
  301. * @see _.any
  302. **/
  303. some<T>(
  304. list: _.Collection<T>,
  305. iterator?: _.ListIterator<T, boolean>,
  306. context?: any): boolean;
  307. /**
  308. * Returns true if the value is present in the list. Uses indexOf internally,
  309. * if list is an Array.
  310. * @param list Checks each element to see if `value` is present.
  311. * @param value The value to check for within `list`.
  312. * @return True if `value` is present in `list`, otherwise false.
  313. **/
  314. contains<T>(
  315. list: _.Collection<T>,
  316. value: T): boolean;
  317. /**
  318. * @see _.contains
  319. **/
  320. include<T>(
  321. list: _.Collection<T>,
  322. value: T): boolean;
  323. /**
  324. * Calls the method named by methodName on each value in the list. Any extra arguments passed to
  325. * invoke will be forwarded on to the method invocation.
  326. * @param list The element's in this list will each have the method `methodName` invoked.
  327. * @param methodName The method's name to call on each element within `list`.
  328. * @param arguments Additional arguments to pass to the method `methodName`.
  329. **/
  330. invoke<T extends {}>(
  331. list: _.Collection<T>,
  332. methodName: string,
  333. ...arguments: any[]): any;
  334. /**
  335. * A convenient version of what is perhaps the most common use-case for map: extracting a list of
  336. * property values.
  337. * @param list The list to pluck elements out of that have the property `propertyName`.
  338. * @param propertyName The property to look for on each element within `list`.
  339. * @return The list of elements within `list` that have the property `propertyName`.
  340. **/
  341. pluck<T extends {}>(
  342. list: _.Collection<T>,
  343. propertyName: string): any[];
  344. /**
  345. * Returns the maximum value in list.
  346. * @param list Finds the maximum value in this list.
  347. * @return Maximum value in `list`.
  348. **/
  349. max(list: _.List<number>): number;
  350. /**
  351. * Returns the maximum value in list. If iterator is passed, it will be used on each value to generate
  352. * the criterion by which the value is ranked.
  353. * @param list Finds the maximum value in this list.
  354. * @param iterator Compares each element in `list` to find the maximum value.
  355. * @param context `this` object in `iterator`, optional.
  356. * @return The maximum element within `list`.
  357. **/
  358. max<T>(
  359. list: _.Collection<T>,
  360. iterator?: _.ListIterator<T, any>,
  361. context?: any): T;
  362. /**
  363. * Returns the minimum value in list.
  364. * @param list Finds the minimum value in this list.
  365. * @return Minimum value in `list`.
  366. **/
  367. min(list: _.List<number>): number;
  368. /**
  369. * Returns the minimum value in list. If iterator is passed, it will be used on each value to generate
  370. * the criterion by which the value is ranked.
  371. * @param list Finds the minimum value in this list.
  372. * @param iterator Compares each element in `list` to find the minimum value.
  373. * @param context `this` object in `iterator`, optional.
  374. * @return The minimum element within `list`.
  375. **/
  376. min<T>(
  377. list: _.Collection<T>,
  378. iterator?: _.ListIterator<T, any>,
  379. context?: any): T;
  380. /**
  381. * Returns a sorted copy of list, ranked in ascending order by the results of running each value
  382. * through iterator. Iterator may also be the string name of the property to sort by (eg. length).
  383. * @param list Sorts this list.
  384. * @param iterator Sort iterator for each element within `list`.
  385. * @param context `this` object in `iterator`, optional.
  386. * @return A sorted copy of `list`.
  387. **/
  388. sortBy<T, TSort>(
  389. list: _.List<T>,
  390. iterator?: _.ListIterator<T, TSort>,
  391. context?: any): T[];
  392. /**
  393. * @see _.sortBy
  394. * @param iterator Sort iterator for each element within `list`.
  395. **/
  396. sortBy<T>(
  397. list: _.List<T>,
  398. iterator: string,
  399. context?: any): T[];
  400. /**
  401. * Splits a collection into sets, grouped by the result of running each value through iterator.
  402. * If iterator is a string instead of a function, groups by the property named by iterator on
  403. * each of the values.
  404. * @param list Groups this list.
  405. * @param iterator Group iterator for each element within `list`, return the key to group the element by.
  406. * @param context `this` object in `iterator`, optional.
  407. * @return An object with the group names as properties where each property contains the grouped elements from `list`.
  408. **/
  409. groupBy<T>(
  410. list: _.List<T>,
  411. iterator?: _.ListIterator<T, any>,
  412. context?: any): _.Dictionary<T[]>;
  413. /**
  414. * @see _.groupBy
  415. * @param iterator Property on each object to group them by.
  416. **/
  417. groupBy<T>(
  418. list: _.List<T>,
  419. iterator: string,
  420. context?: any): _.Dictionary<T[]>;
  421. /**
  422. * Given a `list`, and an `iterator` function that returns a key for each element in the list (or a property name),
  423. * returns an object with an index of each item. Just like _.groupBy, but for when you know your keys are unique.
  424. **/
  425. indexBy<T>(
  426. list: _.List<T>,
  427. iterator: _.ListIterator<T, any>,
  428. context?: any): _.Dictionary<T>;
  429. /**
  430. * @see _.indexBy
  431. * @param iterator Property on each object to index them by.
  432. **/
  433. indexBy<T>(
  434. list: _.List<T>,
  435. iterator: string,
  436. context?: any): _.Dictionary<T>;
  437. /**
  438. * Sorts a list into groups and returns a count for the number of objects in each group. Similar
  439. * to groupBy, but instead of returning a list of values, returns a count for the number of values
  440. * in that group.
  441. * @param list Group elements in this list and then count the number of elements in each group.
  442. * @param iterator Group iterator for each element within `list`, return the key to group the element by.
  443. * @param context `this` object in `iterator`, optional.
  444. * @return An object with the group names as properties where each property contains the number of elements in that group.
  445. **/
  446. countBy<T>(
  447. list: _.Collection<T>,
  448. iterator?: _.ListIterator<T, any>,
  449. context?: any): _.Dictionary<number[]>;
  450. /**
  451. * @see _.countBy
  452. * @param iterator Function name
  453. **/
  454. countBy<T>(
  455. list: _.Collection<T>,
  456. iterator: string,
  457. context?: any): _.Dictionary<number[]>;
  458. /**
  459. * Returns a shuffled copy of the list, using a version of the Fisher-Yates shuffle.
  460. * @param list List to shuffle.
  461. * @return Shuffled copy of `list`.
  462. **/
  463. shuffle<T>(list: _.Collection<T>): T[];
  464. /**
  465. * Produce a random sample from the `list`. Pass a number to return `n` random elements from the list. Otherwise a single random item will be returned.
  466. * @param list List to sample.
  467. * @return Random sample of `n` elements in `list`.
  468. **/
  469. sample<T>(list: _.Collection<T>, n: number): T[];
  470. /**
  471. * @see _.sample
  472. **/
  473. sample<T>(list: _.Collection<T>): T;
  474. /**
  475. * Converts the list (anything that can be iterated over), into a real Array. Useful for transmuting
  476. * the arguments object.
  477. * @param list object to transform into an array.
  478. * @return `list` as an array.
  479. **/
  480. toArray<T>(list: _.Collection<T>): T[];
  481. /**
  482. * Return the number of values in the list.
  483. * @param list Count the number of values/elements in this list.
  484. * @return Number of values in `list`.
  485. **/
  486. size<T>(list: _.Collection<T>): number;
  487. /*********
  488. * Arrays *
  489. **********/
  490. /**
  491. * Returns the first element of an array. Passing n will return the first n elements of the array.
  492. * @param array Retrieves the first element of this array.
  493. * @return Returns the first element of `array`.
  494. **/
  495. first<T>(array: _.List<T>): T;
  496. /**
  497. * @see _.first
  498. * @param n Return more than one element from `array`.
  499. **/
  500. first<T>(
  501. array: _.List<T>,
  502. n: number): T[];
  503. /**
  504. * @see _.first
  505. **/
  506. head<T>(array: _.List<T>): T;
  507. /**
  508. * @see _.first
  509. **/
  510. head<T>(
  511. array: _.List<T>,
  512. n: number): T[];
  513. /**
  514. * @see _.first
  515. **/
  516. take<T>(array: _.List<T>): T;
  517. /**
  518. * @see _.first
  519. **/
  520. take<T>(
  521. array: _.List<T>,
  522. n: number): T[];
  523. /**
  524. * Returns everything but the last entry of the array. Especially useful on the arguments object.
  525. * Pass n to exclude the last n elements from the result.
  526. * @param array Retreive all elements except the last `n`.
  527. * @param n Leaves this many elements behind, optional.
  528. * @return Returns everything but the last `n` elements of `array`.
  529. **/
  530. initial<T>(
  531. array: _.List<T>,
  532. n?: number): T[];
  533. /**
  534. * Returns the last element of an array. Passing n will return the last n elements of the array.
  535. * @param array Retrieves the last element of this array.
  536. * @return Returns the last element of `array`.
  537. **/
  538. last<T>(array: _.List<T>): T;
  539. /**
  540. * @see _.last
  541. * @param n Return more than one element from `array`.
  542. **/
  543. last<T>(
  544. array: _.List<T>,
  545. n: number): T[];
  546. /**
  547. * Returns the rest of the elements in an array. Pass an index to return the values of the array
  548. * from that index onward.
  549. * @param array The array to retrieve all but the first `index` elements.
  550. * @param n The index to start retrieving elements forward from, optional, default = 1.
  551. * @return Returns the elements of `array` from `index` to the end of `array`.
  552. **/
  553. rest<T>(
  554. array: _.List<T>,
  555. n?: number): T[];
  556. /**
  557. * @see _.rest
  558. **/
  559. tail<T>(
  560. array: _.List<T>,
  561. n?: number): T[];
  562. /**
  563. * @see _.rest
  564. **/
  565. drop<T>(
  566. array: _.List<T>,
  567. n?: number): T[];
  568. /**
  569. * Returns a copy of the array with all falsy values removed. In JavaScript, false, null, 0, "",
  570. * undefined and NaN are all falsy.
  571. * @param array Array to compact.
  572. * @return Copy of `array` without false values.
  573. **/
  574. compact<T>(array: _.List<T>): T[];
  575. /**
  576. * Flattens a nested array (the nesting can be to any depth). If you pass shallow, the array will
  577. * only be flattened a single level.
  578. * @param array The array to flatten.
  579. * @param shallow If true then only flatten one level, optional, default = false.
  580. * @return `array` flattened.
  581. **/
  582. flatten(
  583. array: _.List<any>,
  584. shallow?: boolean): any[];
  585. /**
  586. * Returns a copy of the array with all instances of the values removed.
  587. * @param array The array to remove `values` from.
  588. * @param values The values to remove from `array`.
  589. * @return Copy of `array` without `values`.
  590. **/
  591. without<T>(
  592. array: _.List<T>,
  593. ...values: T[]): T[];
  594. /**
  595. * Computes the union of the passed-in arrays: the list of unique items, in order, that are
  596. * present in one or more of the arrays.
  597. * @param arrays Array of arrays to compute the union of.
  598. * @return The union of elements within `arrays`.
  599. **/
  600. union<T>(...arrays: _.List<T>[]): T[];
  601. /**
  602. * Computes the list of values that are the intersection of all the arrays. Each value in the result
  603. * is present in each of the arrays.
  604. * @param arrays Array of arrays to compute the intersection of.
  605. * @return The intersection of elements within `arrays`.
  606. **/
  607. intersection<T>(...arrays: _.List<T>[]): T[];
  608. /**
  609. * Similar to without, but returns the values from array that are not present in the other arrays.
  610. * @param array Keeps values that are within `others`.
  611. * @param others The values to keep within `array`.
  612. * @return Copy of `array` with only `others` values.
  613. **/
  614. difference<T>(
  615. array: _.List<T>,
  616. ...others: _.List<T>[]): T[];
  617. /**
  618. * Produces a duplicate-free version of the array, using === to test object equality. If you know in
  619. * advance that the array is sorted, passing true for isSorted will run a much faster algorithm. If
  620. * you want to compute unique items based on a transformation, pass an iterator function.
  621. * @param array Array to remove duplicates from.
  622. * @param isSorted True if `array` is already sorted, optiona, default = false.
  623. * @param iterator Transform the elements of `array` before comparisons for uniqueness.
  624. * @param context 'this' object in `iterator`, optional.
  625. * @return Copy of `array` where all elements are unique.
  626. **/
  627. uniq<T, TSort>(
  628. array: _.List<T>,
  629. isSorted?: boolean,
  630. iterator?: _.ListIterator<T, TSort>,
  631. context?: any): T[];
  632. /**
  633. * @see _.uniq
  634. **/
  635. uniq<T, TSort>(
  636. array: _.List<T>,
  637. iterator?: _.ListIterator<T, TSort>,
  638. context?: any): T[];
  639. /**
  640. * @see _.uniq
  641. **/
  642. unique<T, TSort>(
  643. array: _.List<T>,
  644. iterator?: _.ListIterator<T, TSort>,
  645. context?: any): T[];
  646. /**
  647. * @see _.uniq
  648. **/
  649. unique<T, TSort>(
  650. array: _.List<T>,
  651. isSorted?: boolean,
  652. iterator?: _.ListIterator<T, TSort>,
  653. context?: any): T[];
  654. /**
  655. * Merges together the values of each of the arrays with the values at the corresponding position.
  656. * Useful when you have separate data sources that are coordinated through matching array indexes.
  657. * If you're working with a matrix of nested arrays, zip.apply can transpose the matrix in a similar fashion.
  658. * @param arrays The arrays to merge/zip.
  659. * @return Zipped version of `arrays`.
  660. **/
  661. zip(...arrays: any[][]): any[][];
  662. /**
  663. * @see _.zip
  664. **/
  665. zip(...arrays: any[]): any[];
  666. /**
  667. * Converts arrays into objects. Pass either a single list of [key, value] pairs, or a
  668. * list of keys, and a list of values.
  669. * @param keys Key array.
  670. * @param values Value array.
  671. * @return An object containing the `keys` as properties and `values` as the property values.
  672. **/
  673. object<TResult extends {}>(
  674. keys: _.List<string>,
  675. values: _.List<any>): TResult;
  676. /**
  677. * Converts arrays into objects. Pass either a single list of [key, value] pairs, or a
  678. * list of keys, and a list of values.
  679. * @param keyValuePairs Array of [key, value] pairs.
  680. * @return An object containing the `keys` as properties and `values` as the property values.
  681. **/
  682. object<TResult extends {}>(...keyValuePairs: any[][]): TResult;
  683. /**
  684. * @see _.object
  685. **/
  686. object<TResult extends {}>(
  687. list: _.List<any>,
  688. values?: any): TResult;
  689. /**
  690. * Returns the index at which value can be found in the array, or -1 if value is not present in the array.
  691. * Uses the native indexOf function unless it's missing. If you're working with a large array, and you know
  692. * that the array is already sorted, pass true for isSorted to use a faster binary search ... or, pass a number
  693. * as the third argument in order to look for the first matching value in the array after the given index.
  694. * @param array The array to search for the index of `value`.
  695. * @param value The value to search for within `array`.
  696. * @param isSorted True if the array is already sorted, optional, default = false.
  697. * @return The index of `value` within `array`.
  698. **/
  699. indexOf<T>(
  700. array: _.List<T>,
  701. value: T,
  702. isSorted?: boolean): number;
  703. /**
  704. * @see _indexof
  705. **/
  706. indexOf<T>(
  707. array: _.List<T>,
  708. value: T,
  709. startFrom: number): number;
  710. /**
  711. * Returns the index of the last occurrence of value in the array, or -1 if value is not present. Uses the
  712. * native lastIndexOf function if possible. Pass fromIndex to start your search at a given index.
  713. * @param array The array to search for the last index of `value`.
  714. * @param value The value to search for within `array`.
  715. * @param from The starting index for the search, optional.
  716. * @return The index of the last occurance of `value` within `array`.
  717. **/
  718. lastIndexOf<T>(
  719. array: _.List<T>,
  720. value: T,
  721. from?: number): number;
  722. /**
  723. * Uses a binary search to determine the index at which the value should be inserted into the list in order
  724. * to maintain the list's sorted order. If an iterator is passed, it will be used to compute the sort ranking
  725. * of each value, including the value you pass.
  726. * @param list The sorted list.
  727. * @param value The value to determine its index within `list`.
  728. * @param iterator Iterator to compute the sort ranking of each value, optional.
  729. * @return The index where `value` should be inserted into `list`.
  730. **/
  731. sortedIndex<T, TSort>(
  732. list: _.List<T>,
  733. value: T,
  734. iterator?: (x: T) => TSort, context?: any): number;
  735. /**
  736. * A function to create flexibly-numbered lists of integers, handy for each and map loops. start, if omitted,
  737. * defaults to 0; step defaults to 1. Returns a list of integers from start to stop, incremented (or decremented)
  738. * by step, exclusive.
  739. * @param start Start here.
  740. * @param stop Stop here.
  741. * @param step The number to count up by each iteration, optional, default = 1.
  742. * @return Array of numbers from `start` to `stop` with increments of `step`.
  743. **/
  744. range(
  745. start: number,
  746. stop: number,
  747. step?: number): number[];
  748. /**
  749. * @see _.range
  750. * @param stop Stop here.
  751. * @return Array of numbers from 0 to `stop` with increments of 1.
  752. * @note If start is not specified the implementation will never pull the step (step = arguments[2] || 0)
  753. **/
  754. range(stop: number): number[];
  755. /*************
  756. * Functions *
  757. *************/
  758. /**
  759. * Bind a function to an object, meaning that whenever the function is called, the value of this will
  760. * be the object. Optionally, bind arguments to the function to pre-fill them, also known as partial application.
  761. * @param func The function to bind `this` to `object`.
  762. * @param context The `this` pointer whenever `fn` is called.
  763. * @param arguments Additional arguments to pass to `fn` when called.
  764. * @return `fn` with `this` bound to `object`.
  765. **/
  766. bind(
  767. func: Function,
  768. context: any,
  769. ...arguments: any[]): () => any;
  770. /**
  771. * Binds a number of methods on the object, specified by methodNames, to be run in the context of that object
  772. * whenever they are invoked. Very handy for binding functions that are going to be used as event handlers,
  773. * which would otherwise be invoked with a fairly useless this. If no methodNames are provided, all of the
  774. * object's function properties will be bound to it.
  775. * @param object The object to bind the methods `methodName` to.
  776. * @param methodNames The methods to bind to `object`, optional and if not provided all of `object`'s
  777. * methods are bound.
  778. **/
  779. bindAll(
  780. object: any,
  781. ...methodNames: string[]): any;
  782. /**
  783. * Partially apply a function by filling in any number of its arguments, without changing its dynamic this value.
  784. * A close cousin of bind.
  785. * @param fn Function to partially fill in arguments.
  786. * @param arguments The partial arguments.
  787. * @return `fn` with partially filled in arguments.
  788. **/
  789. partial(
  790. fn: Function,
  791. ...arguments: any[]): Function;
  792. /**
  793. * Memoizes a given function by caching the computed result. Useful for speeding up slow-running computations.
  794. * If passed an optional hashFunction, it will be used to compute the hash key for storing the result, based
  795. * on the arguments to the original function. The default hashFunction just uses the first argument to the
  796. * memoized function as the key.
  797. * @param fn Computationally expensive function that will now memoized results.
  798. * @param hashFn Hash function for storing the result of `fn`.
  799. * @return Memoized version of `fn`.
  800. **/
  801. memoize(
  802. fn: Function,
  803. hashFn?: (...args: any[]) => string): Function;
  804. /**
  805. * Much like setTimeout, invokes function after wait milliseconds. If you pass the optional arguments,
  806. * they will be forwarded on to the function when it is invoked.
  807. * @param fn Function to delay `waitMS` amount of ms.
  808. * @param wait The amount of milliseconds to delay `fn`.
  809. * @arguments Additional arguments to pass to `fn`.
  810. **/
  811. delay(
  812. func: Function,
  813. wait: number,
  814. ...arguments: any[]): any;
  815. /**
  816. * @see _delay
  817. **/
  818. delay(
  819. func: Function,
  820. ...arguments: any[]): any;
  821. /**
  822. * Defers invoking the function until the current call stack has cleared, similar to using setTimeout
  823. * with a delay of 0. Useful for performing expensive computations or HTML rendering in chunks without
  824. * blocking the UI thread from updating. If you pass the optional arguments, they will be forwarded on
  825. * to the function when it is invoked.
  826. * @param fn The function to defer.
  827. * @param arguments Additional arguments to pass to `fn`.
  828. **/
  829. defer(
  830. fn: Function,
  831. ...arguments: any[]): void;
  832. /**
  833. * Creates and returns a new, throttled version of the passed function, that, when invoked repeatedly,
  834. * will only actually call the original function at most once per every wait milliseconds. Useful for
  835. * rate-limiting events that occur faster than you can keep up with.
  836. * By default, throttle will execute the function as soon as you call it for the first time, and,
  837. * if you call it again any number of times during the wait period, as soon as that period is over.
  838. * If you'd like to disable the leading-edge call, pass {leading: false}, and if you'd like to disable
  839. * the execution on the trailing-edge, pass {trailing: false}.
  840. * @param fn Function to throttle `waitMS` ms.
  841. * @param wait The number of milliseconds to wait before `fn` can be invoked again.
  842. * @param options Allows for disabling execution of the throttled function on either the leading or trailing edge.
  843. * @return `fn` with a throttle of `wait`.
  844. **/
  845. throttle(
  846. func: any,
  847. wait: number,
  848. options?: _.ThrottleSettings): Function;
  849. /**
  850. * Creates and returns a new debounced version of the passed function that will postpone its execution
  851. * until after wait milliseconds have elapsed since the last time it was invoked. Useful for implementing
  852. * behavior that should only happen after the input has stopped arriving. For example: rendering a preview
  853. * of a Markdown comment, recalculating a layout after the window has stopped being resized, and so on.
  854. *
  855. * Pass true for the immediate parameter to cause debounce to trigger the function on the leading instead
  856. * of the trailing edge of the wait interval. Useful in circumstances like preventing accidental double
  857. *-clicks on a "submit" button from firing a second time.
  858. * @param fn Function to debounce `waitMS` ms.
  859. * @param wait The number of milliseconds to wait before `fn` can be invoked again.
  860. * @param immediate True if `fn` should be invoked on the leading edge of `waitMS` instead of the trailing edge.
  861. * @return Debounced version of `fn` that waits `wait` ms when invoked.
  862. **/
  863. debounce(
  864. fn: Function,
  865. wait: number,
  866. immediate?: boolean): Function;
  867. /**
  868. * Creates a version of the function that can only be called one time. Repeated calls to the modified
  869. * function will have no effect, returning the value from the original call. Useful for initialization
  870. * functions, instead of having to set a boolean flag and then check it later.
  871. * @param fn Function to only execute once.
  872. * @return Copy of `fn` that can only be invoked once.
  873. **/
  874. once(fn: Function): Function;
  875. /**
  876. * Creates a version of the function that will only be run after first being called count times. Useful
  877. * for grouping asynchronous responses, where you want to be sure that all the async calls have finished,
  878. * before proceeding.
  879. * @param count Number of times to be called before actually executing.
  880. * @fn The function to defer execution `count` times.
  881. * @return Copy of `fn` that will not execute until it is invoked `count` times.
  882. **/
  883. after(
  884. count: number,
  885. fn: Function): Function;
  886. /**
  887. * Wraps the first function inside of the wrapper function, passing it as the first argument. This allows
  888. * the wrapper to execute code before and after the function runs, adjust the arguments, and execute it
  889. * conditionally.
  890. * @param fn Function to wrap.
  891. * @param wrapper The function that will wrap `fn`.
  892. * @return Wrapped version of `fn.
  893. **/
  894. wrap(
  895. fn: Function,
  896. wrapper: (fn: Function, ...args: any[]) => any): Function;
  897. /**
  898. * Returns the composition of a list of functions, where each function consumes the return value of the
  899. * function that follows. In math terms, composing the functions f(), g(), and h() produces f(g(h())).
  900. * @param functions List of functions to compose.
  901. * @return Composition of `functions`.
  902. **/
  903. compose(...functions: Function[]): Function;
  904. /**********
  905. * Objects *
  906. ***********/
  907. /**
  908. * Retrieve all the names of the object's properties.
  909. * @param object Retreive the key or property names from this object.
  910. * @return List of all the property names on `object`.
  911. **/
  912. keys(object: any): string[];
  913. /**
  914. * Return all of the values of the object's properties.
  915. * @param object Retreive the values of all the properties on this object.
  916. * @return List of all the values on `object`.
  917. **/
  918. values(object: any): any[];
  919. /**
  920. * Convert an object into a list of [key, value] pairs.
  921. * @param object Convert this object to a list of [key, value] pairs.
  922. * @return List of [key, value] pairs on `object`.
  923. **/
  924. pairs(object: any): any[][];
  925. /**
  926. * Returns a copy of the object where the keys have become the values and the values the keys.
  927. * For this to work, all of your object's values should be unique and string serializable.
  928. * @param object Object to invert key/value pairs.
  929. * @return An inverted key/value paired version of `object`.
  930. **/
  931. invert(object: any): any;
  932. /**
  933. * Returns a sorted list of the names of every method in an object - that is to say,
  934. * the name of every function property of the object.
  935. * @param object Object to pluck all function property names from.
  936. * @return List of all the function names on `object`.
  937. **/
  938. functions(object: any): string[];
  939. /**
  940. * @see _functions
  941. **/
  942. methods(object: any): string[];
  943. /**
  944. * Copy all of the properties in the source objects over to the destination object, and return
  945. * the destination object. It's in-order, so the last source will override properties of the
  946. * same name in previous arguments.
  947. * @param destination Object to extend all the properties from `sources`.
  948. * @param sources Extends `destination` with all properties from these source objects.
  949. * @return `destination` extended with all the properties from the `sources` objects.
  950. **/
  951. extend(
  952. destination: any,
  953. ...sources: any[]): any;
  954. /**
  955. * Return a copy of the object, filtered to only have values for the whitelisted keys
  956. * (or array of valid keys).
  957. * @param object Object to strip unwanted key/value pairs.
  958. * @keys The key/value pairs to keep on `object`.
  959. * @return Copy of `object` with only the `keys` properties.
  960. **/
  961. pick(
  962. object: any,
  963. ...keys: string[]): any;
  964. /**
  965. * Return a copy of the object, filtered to omit the blacklisted keys (or array of keys).
  966. * @param object Object to strip unwanted key/value pairs.
  967. * @param keys The key/value pairs to remove on `object`.
  968. * @return Copy of `object` without the `keys` properties.
  969. **/
  970. omit(
  971. object: any,
  972. ...keys: string[]): any;
  973. /**
  974. * @see _.omit
  975. **/
  976. omit(
  977. object: any,
  978. keys: string[]): any;
  979. /**
  980. * Fill in null and undefined properties in object with values from the defaults objects,
  981. * and return the object. As soon as the property is filled, further defaults will have no effect.
  982. * @param object Fill this object with default values.
  983. * @param defaults The default values to add to `object`.
  984. * @return `object` with added `defaults` values.
  985. **/
  986. defaults(
  987. object: any,
  988. ...defaults: any[]): any;
  989. /**
  990. * Create a shallow-copied clone of the object.
  991. * Any nested objects or arrays will be copied by reference, not duplicated.
  992. * @param object Object to clone.
  993. * @return Copy of `object`.
  994. **/
  995. clone<T>(object: T): T;
  996. /**
  997. * Invokes interceptor with the object, and then returns object. The primary purpose of this method
  998. * is to "tap into" a method chain, in order to perform operations on intermediate results within the chain.
  999. * @param object Argument to `interceptor`.
  1000. * @param intercepter The function to modify `object` before continuing the method chain.
  1001. * @return Modified `object`.
  1002. **/
  1003. tap<T>(object: T, intercepter: Function): T;
  1004. /**
  1005. * Does the object contain the given key? Identical to object.hasOwnProperty(key), but uses a safe
  1006. * reference to the hasOwnProperty function, in case it's been overridden accidentally.
  1007. * @param object Object to check for `key`.
  1008. * @param key The key to check for on `object`.
  1009. * @return True if `key` is a property on `object`, otherwise false.
  1010. **/
  1011. has(object: any, key: string): boolean;
  1012. /**
  1013. * Performs an optimized deep comparison between the two objects,
  1014. * to determine if they should be considered equal.
  1015. * @param object Compare to `other`.
  1016. * @param other Compare to `object`.
  1017. * @return True if `object` is equal to `other`.
  1018. **/
  1019. isEqual(object: any, other: any): boolean;
  1020. /**
  1021. * Returns true if object contains no values.
  1022. * @param object Check if this object has no properties or values.
  1023. * @return True if `object` is empty.
  1024. **/
  1025. isEmpty(object: any): boolean;
  1026. /**
  1027. * Returns true if object is a DOM element.
  1028. * @param object Check if this object is a DOM element.
  1029. * @return True if `object` is a DOM element, otherwise false.
  1030. **/
  1031. isElement(object: any): boolean;
  1032. /**
  1033. * Returns true if object is an Array.
  1034. * @param object Check if this object is an Array.
  1035. * @return True if `object` is an Array, otherwise false.
  1036. **/
  1037. isArray(object: any): boolean;
  1038. /**
  1039. * Returns true if value is an Object. Note that JavaScript arrays and functions are objects,
  1040. * while (normal) strings and numbers are not.
  1041. * @param object Check if this object is an Object.
  1042. * @return True of `object` is an Object, otherwise false.
  1043. **/
  1044. isObject(object: any): boolean;
  1045. /**
  1046. * Returns true if object is an Arguments object.
  1047. * @param object Check if this object is an Arguments object.
  1048. * @return True if `object` is an Arguments object, otherwise false.
  1049. **/
  1050. isArguments(object: any): boolean;
  1051. /**
  1052. * Returns true if object is a Function.
  1053. * @param object Check if this object is a Function.
  1054. * @return True if `object` is a Function, otherwise false.
  1055. **/
  1056. isFunction(object: any): boolean;
  1057. /**
  1058. * Returns true if object is a String.
  1059. * @param object Check if this object is a String.
  1060. * @return True if `object` is a String, otherwise false.
  1061. **/
  1062. isString(object: any): boolean;
  1063. /**
  1064. * Returns true if object is a Number (including NaN).
  1065. * @param object Check if this object is a Number.
  1066. * @return True if `object` is a Number, otherwise false.
  1067. **/
  1068. isNumber(object: any): boolean;
  1069. /**
  1070. * Returns true if object is a finite Number.
  1071. * @param object Check if this object is a finite Number.
  1072. * @return True if `object` is a finite Number.
  1073. **/
  1074. isFinite(object: any): boolean;
  1075. /**
  1076. * Returns true if object is either true or false.
  1077. * @param object Check if this object is a bool.
  1078. * @return True if `object` is a bool, otherwise false.
  1079. **/
  1080. isBoolean(object: any): boolean;
  1081. /**
  1082. * Returns true if object is a Date.
  1083. * @param object Check if this object is a Date.
  1084. * @return True if `object` is a Date, otherwise false.
  1085. **/
  1086. isDate(object: any): boolean;
  1087. /**
  1088. * Returns true if object is a RegExp.
  1089. * @param object Check if this object is a RegExp.
  1090. * @return True if `object` is a RegExp, otherwise false.
  1091. **/
  1092. isRegExp(object: any): boolean;
  1093. /**
  1094. * Returns true if object is NaN.
  1095. * Note: this is not the same as the native isNaN function,
  1096. * which will also return true if the variable is undefined.
  1097. * @param object Check if this object is NaN.
  1098. * @return True if `object` is NaN, otherwise false.
  1099. **/
  1100. isNaN(object: any): boolean;
  1101. /**
  1102. * Returns true if the value of object is null.
  1103. * @param object Check if this object is null.
  1104. * @return True if `object` is null, otherwise false.
  1105. **/
  1106. isNull(object: any): boolean;
  1107. /**
  1108. * Returns true if value is undefined.
  1109. * @param object Check if this object is undefined.
  1110. * @return True if `object` is undefined, otherwise false.
  1111. **/
  1112. isUndefined(value: any): boolean;
  1113. /* *********
  1114. * Utility *
  1115. ********** */
  1116. /**
  1117. * Give control of the "_" variable back to its previous owner.
  1118. * Returns a reference to the Underscore object.
  1119. * @return Underscore object reference.
  1120. **/
  1121. noConflict(): any;
  1122. /**
  1123. * Returns the same value that is used as the argument. In math: f(x) = x
  1124. * This function looks useless, but is used throughout Underscore as a default iterator.
  1125. * @param value Identity of this object.
  1126. * @return `value`.
  1127. **/
  1128. identity<T>(value: T): T;
  1129. /**
  1130. * Invokes the given iterator function n times.
  1131. * Each invocation of iterator is called with an index argument
  1132. * @param n Number of times to invoke `iterator`.
  1133. * @param iterator Function iterator to invoke `n` times.
  1134. * @param context `this` object in `iterator`, optional.
  1135. **/
  1136. times<TResult>(n: number, iterator: (n: number) => TResult, context?: any): TResult[];
  1137. /**
  1138. * Returns a random integer between min and max, inclusive. If you only pass one argument,
  1139. * it will return a number between 0 and that number.
  1140. * @param max The maximum random number.
  1141. * @return A random number between 0 and `max`.
  1142. **/
  1143. random(max: number): number;
  1144. /**
  1145. * @see _.random
  1146. * @param min The minimum random number.
  1147. * @return A random number between `min` and `max`.
  1148. **/
  1149. random(min: number, max: number): number;
  1150. /**
  1151. * Allows you to extend Underscore with your own utility functions. Pass a hash of
  1152. * {name: function} definitions to have your functions added to the Underscore object,
  1153. * as well as the OOP wrapper.
  1154. * @param object Mixin object containing key/function pairs to add to the Underscore object.
  1155. **/
  1156. mixin(object: any): void;
  1157. /**
  1158. * Generate a globally-unique id for client-side models or DOM elements that need one.
  1159. * If prefix is passed, the id will be appended to it. Without prefix, returns an integer.
  1160. * @param prefix A prefix string to start the unique ID with.
  1161. * @return Unique string ID beginning with `prefix`.
  1162. **/
  1163. uniqueId(prefix: string): string;
  1164. /**
  1165. * @see _.uniqueId
  1166. **/
  1167. uniqueId(): number;
  1168. /**
  1169. * Escapes a string for insertion into HTML, replacing &, <, >, ", ', and / characters.
  1170. * @param str Raw string to escape.
  1171. * @return `str` HTML escaped.
  1172. **/
  1173. escape(str: string): string;
  1174. /**
  1175. * If the value of the named property is a function then invoke it; otherwise, return it.
  1176. * @param object Object to maybe invoke function `property` on.
  1177. * @param property The function by name to invoke on `object`.
  1178. * @return The result of invoking the function `property` on `object.
  1179. **/
  1180. result(object: any, property: string): any;
  1181. /**
  1182. * Compiles JavaScript templates into functions that can be evaluated for rendering. Useful
  1183. * for rendering complicated bits of HTML from JSON data sources. Template functions can both
  1184. * interpolate variables, using <%= ... %>, as well as execute arbitrary JavaScript code, with
  1185. * <% ... %>. If you wish to interpolate a value, and have it be HTML-escaped, use <%- ... %> When
  1186. * you evaluate a template function, pass in a data object that has properties corresponding to
  1187. * the template's free variables. If you're writing a one-off, you can pass the data object as
  1188. * the second parameter to template in order to render immediately instead of returning a template
  1189. * function. The settings argument should be a hash containing any _.templateSettings that should
  1190. * be overridden.
  1191. * @param templateString Underscore HTML template.
  1192. * @param data Data to use when compiling `templateString`.
  1193. * @param settings Settings to use while compiling.
  1194. * @return Returns the compiled Underscore HTML template.
  1195. **/
  1196. template(templateString: string, data?: any, settings?: _.TemplateSettings): (...data: any[]) => string;
  1197. /**
  1198. * By default, Underscore uses ERB-style template delimiters, change the
  1199. * following template settings to use alternative delimiters.
  1200. **/
  1201. templateSettings: _.TemplateSettings;
  1202. /* **********
  1203. * Chaining *
  1204. *********** */
  1205. /**
  1206. * Returns a wrapped object. Calling methods on this object will continue to return wrapped objects
  1207. * until value() is used.
  1208. * @param obj Object to chain.
  1209. * @return Wrapped `obj`.
  1210. **/
  1211. chain<T>(obj: T[]): _Chain<T>;
  1212. chain<T extends {}>(obj: T): _Chain<T>;
  1213. /**
  1214. * Extracts the value of a wrapped object.
  1215. * @param obj Wrapped object to extract the value from.
  1216. * @return Value of `obj`.
  1217. **/
  1218. value<T, TResult>(obj: T): TResult;
  1219. }
  1220. interface Underscore<T> {
  1221. /* *************
  1222. * Collections *
  1223. ************* */
  1224. /**
  1225. * Wrapped type `any[]`.
  1226. * @see _.each
  1227. **/
  1228. each(iterator: _.ListIterator<T, void>, context?: any): void;
  1229. /**
  1230. * @see _.each
  1231. **/
  1232. each(iterator: _.ObjectIterator<T, void>, context?: any): void;
  1233. /**
  1234. * @see _.each
  1235. **/
  1236. forEach(iterator: _.ListIterator<T, void>, context?: any): void;
  1237. /**
  1238. * @see _.each
  1239. **/
  1240. forEach(iterator: _.ObjectIterator<T, void>, context?: any): void;
  1241. /**
  1242. * Wrapped type `any[]`.
  1243. * @see _.map
  1244. **/
  1245. map<TResult>(iterator: _.ListIterator<T, TResult>, context?: any): TResult[];
  1246. /**
  1247. * Wrapped type `any[]`.
  1248. * @see _.map
  1249. **/
  1250. map<TResult>(iterator: _.ObjectIterator<T, TResult>, context?: any): TResult[];
  1251. /**
  1252. * @see _.map
  1253. **/
  1254. collect<TResult>(iterator: _.ListIterator<T, TResult>, context?: any): TResult[];
  1255. /**
  1256. * @see _.map
  1257. **/
  1258. collect<TResult>(iterator: _.ObjectIterator<T, TResult>, context?: any): TResult[];
  1259. /**
  1260. * Wrapped type `any[]`.
  1261. * @see _.reduce
  1262. **/
  1263. reduce<TResult>(iterator: _.MemoIterator<T, TResult>, memo?: TResult, context?: any): TResult;
  1264. /**
  1265. * @see _.reduce
  1266. **/
  1267. inject<TResult>(iterator: _.MemoIterator<T, TResult>, memo?: TResult, context?: any): TResult;
  1268. /**
  1269. * @see _.reduce
  1270. **/
  1271. foldl<TResult>(iterator: _.MemoIterator<T, TResult>, memo?: TResult, context?: any): TResult;
  1272. /**
  1273. * Wrapped type `any[]`.
  1274. * @see _.reduceRight
  1275. **/
  1276. reduceRight<TResult>(iterator: _.MemoIterator<T, TResult>, memo?: TResult, context?: any): TResult;
  1277. /**
  1278. * @see _.reduceRight
  1279. **/
  1280. foldr<TResult>(iterator: _.MemoIterator<T, TResult>, memo?: TResult, context?: any): TResult;
  1281. /**
  1282. * Wrapped type `any[]`.
  1283. * @see _.find
  1284. **/
  1285. find(iterator: _.ListIterator<T, boolean>, context?: any): T;
  1286. /**
  1287. * @see _.find
  1288. **/
  1289. detect(iterator: _.ListIterator<T, boolean>, context?: any): T;
  1290. /**
  1291. * Wrapped type `any[]`.
  1292. * @see _.filter
  1293. **/
  1294. filter(iterator: _.ListIterator<T, boolean>, context?: any): T[];
  1295. /**
  1296. * @see _.filter
  1297. **/
  1298. select(iterator: _.ListIterator<T, boolean>, context?: any): T[];
  1299. /**
  1300. * Wrapped type `any[]`.
  1301. * @see _.where
  1302. **/
  1303. where<U extends {}>(properties: U): T[];
  1304. /**
  1305. * Wrapped type `any[]`.
  1306. * @see _.findWhere
  1307. **/
  1308. findWhere<U extends {}>(properties: U): T;
  1309. /**
  1310. * Wrapped type `any[]`.
  1311. * @see _.reject
  1312. **/
  1313. reject(iterator: _.ListIterator<T, boolean>, context?: any): T[];
  1314. /**
  1315. * Wrapped type `any[]`.
  1316. * @see _.all
  1317. **/
  1318. all(iterator?: _.ListIterator<T, boolean>, context?: any): boolean;
  1319. /**
  1320. * @see _.all
  1321. **/
  1322. every(iterator?: _.ListIterator<T, boolean>, context?: any): boolean;
  1323. /**
  1324. * Wrapped type `any[]`.
  1325. * @see _.any
  1326. **/
  1327. any(iterator?: _.ListIterator<T, boolean>, context?: any): boolean;
  1328. /**
  1329. * @see _.any
  1330. **/
  1331. some(iterator?: _.ListIterator<T, boolean>, context?: any): boolean;
  1332. /**
  1333. * Wrapped type `any[]`.
  1334. * @see _.contains
  1335. **/
  1336. contains(value: T): boolean;
  1337. /**
  1338. * Alias for 'contains'.
  1339. * @see contains
  1340. **/
  1341. include(value: T): boolean;
  1342. /**
  1343. * Wrapped type `any[]`.
  1344. * @see _.invoke
  1345. **/
  1346. invoke(methodName: string, ...arguments: any[]): any;
  1347. /**
  1348. * Wrapped type `any[]`.
  1349. * @see _.pluck
  1350. **/
  1351. pluck(propertyName: string): any[];
  1352. /**
  1353. * Wrapped type `number[]`.
  1354. * @see _.max
  1355. **/
  1356. max(): number;
  1357. /**
  1358. * Wrapped type `any[]`.
  1359. * @see _.max
  1360. **/
  1361. max(iterator: _.ListIterator<T, number>, context?: any): T;
  1362. /**
  1363. * Wrapped type `any[]`.
  1364. * @see _.max
  1365. **/
  1366. max(iterator?: _.ListIterator<T, any>, context?: any): T;
  1367. /**
  1368. * Wrapped type `number[]`.
  1369. * @see _.min
  1370. **/
  1371. min(): number;
  1372. /**
  1373. * Wrapped type `any[]`.
  1374. * @see _.min
  1375. **/
  1376. min(iterator: _.ListIterator<T, number>, context?: any): T;
  1377. /**
  1378. * Wrapped type `any[]`.
  1379. * @see _.min
  1380. **/
  1381. min(iterator?: _.ListIterator<T, any>, context?: any): T;
  1382. /**
  1383. * Wrapped type `any[]`.
  1384. * @see _.sortBy
  1385. **/
  1386. sortBy(iterator?: _.ListIterator<T, any>, context?: any): T[];
  1387. /**
  1388. * Wrapped type `any[]`.
  1389. * @see _.sortBy
  1390. **/
  1391. sortBy(iterator: string, context?: any): T[];
  1392. /**
  1393. * Wrapped type `any[]`.
  1394. * @see _.groupBy
  1395. **/
  1396. groupBy(iterator?: _.ListIterator<T, any>, context?: any): _.Dictionary<_.List<T>>;
  1397. /**
  1398. * Wrapped type `any[]`.
  1399. * @see _.groupBy
  1400. **/
  1401. groupBy(iterator: string, context?: any): _.Dictionary<T[]>;
  1402. /**
  1403. * Wrapped type `any[]`.
  1404. * @see _.indexBy
  1405. **/
  1406. indexBy(iterator: _.ListIterator<T, any>, context?: any): _.Dictionary<T>;
  1407. /**
  1408. * Wrapped type `any[]`.
  1409. * @see _.indexBy
  1410. **/
  1411. indexBy(iterator: string, context?: any): _.Dictionary<T>;
  1412. /**
  1413. * Wrapped type `any[]`.
  1414. * @see _.countBy
  1415. **/
  1416. countBy(iterator?: _.ListIterator<T, any>, context?: any): _.Dictionary<number[]>;
  1417. /**
  1418. * Wrapped type `any[]`.
  1419. * @see _.countBy
  1420. **/
  1421. countBy(iterator: string, context?: any): _.Dictionary<number[]>;
  1422. /**
  1423. * Wrapped type `any[]`.
  1424. * @see _.shuffle
  1425. **/
  1426. shuffle(): T[];
  1427. /**
  1428. * Wrapped type `any[]`.
  1429. * @see _.sample
  1430. **/
  1431. samp

Large files files are truncated, but you can click here to view the full file