added _.forInRight definition

This commit is contained in:
Brian Zengel
2013-10-20 12:29:20 -04:00
parent 47dfdd98a2
commit 04086de406
2 changed files with 25 additions and 8 deletions
+12 -8
View File
@@ -72,6 +72,14 @@ var keys: IKey[] = [
{ 'dir': 'right', 'code': 100 }
];
function Dog(name) {
this.name = name;
}
Dog.prototype.bark = function() {
console.log('Woof, woof!');
};
var result;
//Array Method Tests
@@ -554,18 +562,14 @@ result = <string>_.findLastKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num)
return num % 2 == 1;
});
function Dog(name) {
this.name = name;
}
Dog.prototype.bark = function() {
console.log('Woof, woof!');
};
_.forIn(new Dog('Dagny'), function(value, key) {
console.log(key);
});
_.forInRight(new Dog('Dagny'), function(value, key) {
console.log(key);
});
var mergeNames = {
'stooges': [
{ 'name': 'moe' },
+13
View File
@@ -2277,6 +2277,19 @@ declare module _ {
callback?: ObjectIterator<T, void>,
thisArg?: any): Dictionary<T>;
/**
* This method is like _.forIn except that it iterates over elements of a collection in the
* opposite order.
* @param object The object to iterate over.
* @param callback The function called per iteration.
* @param thisArg The this binding of callback.
* @return object
**/
export function forInRight<T extends {}>(
object: Dictionary<T>,
callback?: ObjectIterator<T, void>,
thisArg?: any): Dictionary<T>;
/**
* Recursively merges own enumerable properties of the source object(s), that don't resolve