From 6647bd5b27b8a7678f6033d87dee28592bdfa16f Mon Sep 17 00:00:00 2001 From: Brian Zengel Date: Sun, 20 Oct 2013 12:32:37 -0400 Subject: [PATCH] added _.forOwn definitions --- lodash/lodash-tests.ts | 4 ++++ lodash/lodash.d.ts | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 1dc20268bf..1049e51a57 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -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' }, diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index d4d1b47c3f..aca02b02d4 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -2290,6 +2290,20 @@ declare module _ { callback?: ObjectIterator, thisArg?: any): Dictionary; + /** + * 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( + object: Dictionary, + callback?: ObjectIterator, + thisArg?: any): Dictionary; + /** * Recursively merges own enumerable properties of the source object(s), that don't resolve