forEachRight bindings and tests

This commit is contained in:
Brian Zengel
2013-11-06 22:14:38 -05:00
parent 43c3e27986
commit 4cd546fef7
2 changed files with 44 additions and 3 deletions
+6
View File
@@ -377,6 +377,12 @@ result = <LoDash.Dictionary<number>>_.forEachRight({ 'one': 1, 'two': 2, 'three'
result = <number[]>_.eachRight([1, 2, 3], function(num) { console.log(num); });
result = <LoDash.Dictionary<number>>_.eachRight({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); });
result = <LoDash.LoDashArrayWrapper<number>>_([1, 2, 3]).forEachRight(function(num) { console.log(num); });
result = <LoDash.LoDashObjectWrapper<LoDash.Dictionary<number>>>_({ 'one': 1, 'two': 2, 'three': 3 }).forEachRight(function(num) { console.log(num); });
result = <LoDash.LoDashArrayWrapper<number>>_([1, 2, 3]).eachRight(function(num) { console.log(num); });
result = <LoDash.LoDashObjectWrapper<LoDash.Dictionary<number>>>_({ 'one': 1, 'two': 2, 'three': 3 }).eachRight(function(num) { console.log(num); });
result = <LoDash.Dictionary<number[]>>_.groupBy([4.2, 6.1, 6.4], function(num) { return Math.floor(num); });
result = <LoDash.Dictionary<number[]>>_.groupBy([4.2, 6.1, 6.4], function(num) { return this.floor(num); }, Math);
result = <LoDash.Dictionary<string[]>>_.groupBy(['one', 'two', 'three'], 'length');
+38 -3
View File
@@ -1589,7 +1589,7 @@ declare module LoDash {
thisArg?: any): List<T>;
/**
* @see _.each
* @see _.forEachRight
**/
forEachRight<T extends {}>(
object: Dictionary<T>,
@@ -1597,7 +1597,7 @@ declare module LoDash {
thisArg?: any): Dictionary<T>;
/**
* @see _.each
* @see _.forEachRight
**/
eachRight<T>(
collection: List<T>,
@@ -1605,7 +1605,7 @@ declare module LoDash {
thisArg?: any): List<T>;
/**
* @see _.each
* @see _.forEachRight
* @param object The object to iterate over
* @param callback The function called per iteration.
* @param thisArg The this binding of callback.
@@ -1616,6 +1616,41 @@ declare module LoDash {
thisArg?: any): Dictionary<T>;
}
interface LoDashArrayWrapper<T> {
/**
* @see _.forEachRight
**/
forEachRight<T>(
callback: ListIterator<T, void >,
thisArg?: any): LoDashArrayWrapper<List<T>>;
/**
* @see _.forEachRight
**/
eachRight<T>(
callback: ListIterator<T, void >,
thisArg?: any): LoDashArrayWrapper<List<T>>;
}
interface LoDashObjectWrapper<T> {
/**
* @see _.forEachRight
**/
forEachRight<T extends {}>(
callback: ObjectIterator<T, void >,
thisArg?: any): LoDashObjectWrapper<Dictionary<T>>;
/**
* @see _.forEachRight
* @param object The object to iterate over
* @param callback The function called per iteration.
* @param thisArg The this binding of callback.
**/
eachRight<T extends {}>(
callback: ObjectIterator<T, void>,
thisArg?: any): LoDashObjectWrapper<Dictionary<T>>;
}
//_.groupBy
interface LoDashStatic {
/**