_.forEachRight/_.eachRight definitions

This commit is contained in:
Brian Zengel
2013-10-18 18:51:05 -04:00
parent 8d492cb44e
commit 763dc207ce
2 changed files with 47 additions and 4 deletions

View File

@@ -251,6 +251,12 @@ result = <_.Dictionary<number>>_.forEach({ 'one': 1, 'two': 2, 'three': 3 }, fun
result = <number[]>_.each([1, 2, 3], function(num) { console.log(num); });
result = <_.Dictionary<number>>_.each({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); });
result = <number[]>_.forEachRight([1, 2, 3], function(num) { console.log(num); });
result = <_.Dictionary<number>>_.forEachRight({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); });
result = <number[]>_.eachRight([1, 2, 3], function(num) { console.log(num); });
result = <_.Dictionary<number>>_.eachRight({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); });
result = <any[]>_.map([1, 2, 3], function(num) { return num * 3; });
result = <any[]>_.map({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { return num * 3; });
result = <any[]>_.map(stoogesAges, 'name');

45
lodash/lodash.d.ts vendored
View File

@@ -1052,16 +1052,53 @@ declare module _ {
/**
* @see _.each
* @param object Iterators over this object's properties.
* @param iterator Iterator function for each property on `obj`.
* @param context 'this' object in `iterator`, optional.
* @param object The object to iterate over
* @param callback The function called per iteration.
* @param thisArg The this binding of callback.
**/
export function each<T extends {}>(
object: Dictionary<T>,
callback: ObjectIterator<T, void>,
thisArg?: any): Dictionary<T>;
/**
* This method is like _.forEach except that it iterates over elements of a
* collection from right to left.
* @param collection The collection to iterate over.
* @param callback The function called per iteration.
* @param thisArg The this binding of callback.
**/
export function forEachRight<T>(
collection: List<T>,
callback: ListIterator<T, void >,
thisArg?: any): List<T>;
/**
* @see _.each
**/
export function forEachRight<T extends {}>(
object: Dictionary<T>,
callback: ObjectIterator<T, void >,
thisArg?: any): Dictionary<T>;
/**
* @see _.each
**/
export function eachRight<T>(
collection: List<T>,
callback: ListIterator<T, void>,
thisArg?: any): List<T>;
/**
* @see _.each
* @param object The object to iterate over
* @param callback The function called per iteration.
* @param thisArg The this binding of callback.
**/
export function eachRight<T extends {}>(
object: Dictionary<T>,
callback: ObjectIterator<T, void>,
thisArg?: any): Dictionary<T>;
/**
* Creates an array of values by running each element in the collection through the callback.