Code coverage report for object/deepMixIn.js

Statements: 100% (15 / 15)      Branches: 83.33% (5 / 6)      Functions: 100% (4 / 4)      Lines: 100% (14 / 14)     

All files » object/ » deepMixIn.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 341           1 10       10 11 11 11       10     1 14 14 2   12       1      
define(['./forOwn', '../lang/isPlainObject'], function (forOwn, isPlainObject) {
 
    /**
     * Mixes objects into the target object, recursively mixing existing child
     * objects.
     */
    function deepMixIn(target, objects) {
        var i = 0,
            n = arguments.length,
            obj;
 
        while(++i < n){
            obj = arguments[i];
            Eif (obj) {
                forOwn(obj, copyProp, target);
            }
        }
 
        return target;
    }
 
    function copyProp(val, key) {
        var existing = this[key];
        if (isPlainObject(val) && isPlainObject(existing)) {
            deepMixIn(existing, val);
        } else {
            this[key] = val;
        }
    }
 
    return deepMixIn;
 
});