Code coverage report for object/forOwn.js

Statements: 100% (7 / 7)      Branches: 100% (2 / 2)      Functions: 100% (4 / 4)      Lines: 100% (6 / 6)     

All files » object/ » forOwn.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 191             1 185 415 410         1      
define(['./hasOwn', './forIn'], function (hasOwn, forIn) {
 
    /**
     * Similar to Array/forEach but works over object properties and fixes Don't
     * Enum bug on IE.
     * based on: http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation
     */
    function forOwn(obj, fn, thisObj){
        forIn(obj, function(val, key){
            if (hasOwn(obj, key)) {
                return fn.call(thisObj, obj[key], key, obj);
            }
        });
    }
 
    return forOwn;
 
});