validateParams.js
function(mCons, vCons, k){
            var nCons = {}; // the final nested constraints
            
            // if there are per-key constraints for k, add them all
            if(validate.isObject(mCons[k])){
                nCons = validateParams.extendObject({}, mCons[k]);
            }
            
            // loop through each universal constraint and merge as appropraite
            if(vCons){
                Object.keys(vCons).forEach(function(vn){
                    // only add non-clashing universal constraints
                    if(!nCons[vn]){
                        nCons[vn] = vCons[vn];
                    }
                });
            }
            
            // return the merged constraints
            return nCons;
        }
function(mCons, vCons, k){
            var nCons = {}; // the final nested constraints
            
            // if there are per-key constraints for k, add them all
            if(validate.isObject(mCons[k])){
                nCons = validateParams.extendObject({}, mCons[k]);
            }
            
            // loop through each universal constraint and merge as appropraite
            if(vCons){
                Object.keys(vCons).forEach(function(vn){
                    // only add non-clashing universal constraints
                    if(!nCons[vn]){
                        nCons[vn] = vCons[vn];
                    }
                });
            }
            
            // return the merged constraints
            return nCons;
        }
function ( mCons , vCons , k ) { var nCons = { } ; // the final nested constraints // if there are per-key constraints for k, add them all if ( validate . isObject ( mCons [ k ] ) ) { nCons = validateParams . extendObject ( { } , mCons [ k ] ) ; } // loop through each universal constraint and merge as appropraite if ( vCons ) { Object . keys ( vCons ) . forEach ( function ( vn ) { // only add non-clashing universal constraints if ( ! nCons [ vn ] ) { nCons [ vn ] = vCons [ vn ] ; } } ) ; } // return the merged constraints return nCons ; }
a private inner function for merging per-key and universal constraints
a private inner function for merging per - key and universal constraints