index.js
function(cur, depth, context, collector, subKey) {
        if(depth === context.length) {
            mergeDeep(cur[subKey], collector, false);
            return;
        }
        var value = context[depth];
        if(value.constructor !== Array) {
            var keys = this.precedenceMap[value];
            var n = keys.length;
            for(var j=0; j<n; j++) {
                if(cur[keys[j]] !== undefined) {
                    this._readHelper(cur[keys[j]], depth+1, context, collector, subKey);
                }
            }
        } else {
            var seen = {};
            var i = value.length;
            while(i--) {
                keys = this.precedenceMap[value[i]];
                n = keys.length;
                for(j=0; j<n; j++) {
                    if(cur[keys[j]] !== undefined && seen[keys[j]] === undefined) {
                        this._readHelper(cur[keys[j]], depth+1, context, collector, subKey);
                        seen[keys[j]] = true;
                    }
                }
            }
        }
    }
function(cur, depth, context, collector, subKey) {
        if(depth === context.length) {
            mergeDeep(cur[subKey], collector, false);
            return;
        }
        var value = context[depth];
        if(value.constructor !== Array) {
            var keys = this.precedenceMap[value];
            var n = keys.length;
            for(var j=0; j<n; j++) {
                if(cur[keys[j]] !== undefined) {
                    this._readHelper(cur[keys[j]], depth+1, context, collector, subKey);
                }
            }
        } else {
            var seen = {};
            var i = value.length;
            while(i--) {
                keys = this.precedenceMap[value[i]];
                n = keys.length;
                for(j=0; j<n; j++) {
                    if(cur[keys[j]] !== undefined && seen[keys[j]] === undefined) {
                        this._readHelper(cur[keys[j]], depth+1, context, collector, subKey);
                        seen[keys[j]] = true;
                    }
                }
            }
        }
    }
function ( cur , depth , context , collector , subKey ) { if ( depth === context . length ) { mergeDeep ( cur [ subKey ] , collector , false ) ; return ; } var value = context [ depth ] ; if ( value . constructor !== Array ) { var keys = this . precedenceMap [ value ] ; var n = keys . length ; for ( var j = 0 ; j < n ; j ++ ) { if ( cur [ keys [ j ] ] !== undefined ) { this . _readHelper ( cur [ keys [ j ] ] , depth + 1 , context , collector , subKey ) ; } } } else { var seen = { } ; var i = value . length ; while ( i -- ) { keys = this . precedenceMap [ value [ i ] ] ; n = keys . length ; for ( j = 0 ; j < n ; j ++ ) { if ( cur [ keys [ j ] ] !== undefined && seen [ keys [ j ] ] === undefined ) { this . _readHelper ( cur [ keys [ j ] ] , depth + 1 , context , collector , subKey ) ; seen [ keys [ j ] ] = true ; } } } } }
Recurse through the tree merging configs that apply to the given context.
@param cur {object} the current node.
@param depth {int} current depth in tree.
@param context {array} the context in internal format.
@param collector {object} the config we merge onto.
@param subKey {string} determines if substituted or non-substituted configs are used.
@private
Recurse through the tree merging configs that apply to the given context .