Merge pull request #12022 from vjau/iteratee

[underscore] added iteratee shorthand syntax for some usages of map and uniq
This commit is contained in:
Yui
2016-11-10 16:29:12 -08:00
committed by GitHub
+9 -4
View File
@@ -67,6 +67,10 @@ declare module _ {
(element: T, key: string, list: Dictionary<T>): TResult;
}
type IterateePropertyShorthand = string | number;
type IterateeMatcherShorthand<T> = Dictionary<T>;
interface MemoIterator<T, TResult> {
(prev: TResult, curr: T, index: number, list: List<T>): TResult;
}
@@ -146,7 +150,7 @@ interface UnderscoreStatic {
**/
map<T, TResult>(
list: _.List<T>,
iterator: _.ListIterator<T, TResult>,
iterator: _.ListIterator<T, TResult> | _.IterateePropertyShorthand | _.IterateeMatcherShorthand<any>,
context?: any): TResult[];
/**
@@ -161,12 +165,13 @@ interface UnderscoreStatic {
iterator: _.ObjectIterator<T, TResult>,
context?: any): TResult[];
/**
* @see _.map
**/
collect<T, TResult>(
list: _.List<T>,
iterator: _.ListIterator<T, TResult>,
iterator: _.ListIterator<T, TResult> | _.IterateePropertyShorthand | _.IterateeMatcherShorthand<any>,
context?: any): TResult[];
/**
@@ -900,7 +905,7 @@ interface UnderscoreStatic {
uniq<T, TSort>(
array: _.List<T>,
isSorted?: boolean,
iterator?: _.ListIterator<T, TSort>,
iterator?: _.ListIterator<T, TSort> | _.IterateePropertyShorthand,
context?: any): T[];
/**
@@ -916,7 +921,7 @@ interface UnderscoreStatic {
**/
unique<T, TSort>(
array: _.List<T>,
iterator?: _.ListIterator<T, TSort>,
iterator?: _.ListIterator<T, TSort> | _.IterateePropertyShorthand,
context?: any): T[];
/**