added _.forOwn definitions

This commit is contained in:
Brian Zengel
2013-10-20 12:32:37 -04:00
parent 04086de406
commit 6647bd5b27
2 changed files with 18 additions and 0 deletions
+4
View File
@@ -570,6 +570,10 @@ _.forInRight(new Dog('Dagny'), function(value, key) {
console.log(key);
});
_.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) {
console.log(key);
});
var mergeNames = {
'stooges': [
{ 'name': 'moe' },
+14
View File
@@ -2290,6 +2290,20 @@ declare module _ {
callback?: ObjectIterator<T, void>,
thisArg?: any): Dictionary<T>;
/**
* Iterates over own enumerable properties of an object, executing the callback for each
* property. The callback is bound to thisArg and invoked with three arguments; (value, key,
* object). Callbacks may exit iteration early by explicitly returning false.
* @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 forOwn<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