PageRenderTime 63ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/vendor/types/underscore/underscore.d.ts

https://github.com/dylansong/demo-angularjs-easeljs
TypeScript Typings | 2954 lines | 641 code | 432 blank | 1881 comment | 3 complexity | 2a72b540965ea895f91b0ff4d647d11a MD5 | raw file

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

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