UNPKG

527 BJavaScriptView Raw
1var hasOwn = require('./hasOwn');
2var forIn = require('./forIn');
3
4 /**
5 * Similar to Array/forEach but works over object properties and fixes Don't
6 * Enum bug on IE.
7 * based on: http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation
8 */
9 function forOwn(obj, fn, thisObj){
10 forIn(obj, function(val, key){
11 if (hasOwn(obj, key)) {
12 return fn.call(thisObj, obj[key], key, obj);
13 }
14 });
15 }
16
17 module.exports = forOwn;
18
19