Add definitions for _(...).groupBy

This commit is contained in:
Brian Zengel
2013-11-10 19:40:47 -05:00
parent 106a8f8ae6
commit e7ff6e84c6
2 changed files with 25 additions and 0 deletions
+4
View File
@@ -380,6 +380,10 @@ result = <_.Dictionary<number[]>>_.groupBy([4.2, 6.1, 6.4], function(num) { retu
result = <_.Dictionary<number[]>>_.groupBy([4.2, 6.1, 6.4], function(num) { return this.floor(num); }, Math);
result = <_.Dictionary<string[]>>_.groupBy(['one', 'two', 'three'], 'length');
result = <_.LoDashObjectWrapper<_.Dictionary<number[]>>>_([4.2, 6.1, 6.4]).groupBy(function(num) { return Math.floor(num); });
result = <_.LoDashObjectWrapper<_.Dictionary<number[]>>>_([4.2, 6.1, 6.4]).groupBy(function(num) { return this.floor(num); }, Math);
result = <_.LoDashObjectWrapper<_.Dictionary<string[]>>>_(['one', 'two', 'three']).groupBy('length');
result = <_.Dictionary<IKey>>_.indexBy(keys, 'dir');
result = <_.Dictionary<IKey>>_.indexBy(keys, function(key) { return String.fromCharCode(key.code); });
result = <_.Dictionary<IKey>>_.indexBy(keys, function(key) { this.fromCharCode(key.code); }, String);
+21
View File
@@ -1761,6 +1761,27 @@ declare module _ {
whereValue: W): Dictionary<T[]>;
}
interface LoDashArrayWrapper {
/**
* @see _.groupBy
**/
groupBy<T>(
callback: ListIterator<T, any>,
thisArg?: any): _.LoDashObjectWrapper<Dictionary<T[]>>;
/**
* @see _.groupBy
**/
groupBy<T>(
pluckValue: string): _.LoDashObjectWrapper<Dictionary<T[]>>;
/**
* @see _.groupBy
**/
groupBy<W, T extends W>(
whereValue: W): _.LoDashObjectWrapper<Dictionary<T[]>>;
}
//_.indexBy
interface LoDashStatic {
/**