Sha256: 142a0add697e0ebc9698368d1bb28fba98b2e3188d36159a3bf16f9e2a33761d

Contents?: true

Size: 1.3 KB

Versions: 170

Compression:

Stored size: 1.3 KB

Contents

var Stack = require('./_Stack'),
    assignMergeValue = require('./_assignMergeValue'),
    baseFor = require('./_baseFor'),
    baseMergeDeep = require('./_baseMergeDeep'),
    isObject = require('./isObject'),
    keysIn = require('./keysIn'),
    safeGet = require('./_safeGet');

/**
 * The base implementation of `_.merge` without support for multiple sources.
 *
 * @private
 * @param {Object} object The destination object.
 * @param {Object} source The source object.
 * @param {number} srcIndex The index of `source`.
 * @param {Function} [customizer] The function to customize merged values.
 * @param {Object} [stack] Tracks traversed source values and their merged
 *  counterparts.
 */
function baseMerge(object, source, srcIndex, customizer, stack) {
  if (object === source) {
    return;
  }
  baseFor(source, function(srcValue, key) {
    stack || (stack = new Stack);
    if (isObject(srcValue)) {
      baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
    }
    else {
      var newValue = customizer
        ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
        : undefined;

      if (newValue === undefined) {
        newValue = srcValue;
      }
      assignMergeValue(object, key, newValue);
    }
  }, keysIn);
}

module.exports = baseMerge;

Version data entries

170 entries across 169 versions & 19 rubygems

Version Path
immosquare-cleaner-0.1.60 node_modules/lodash/_baseMerge.js
immosquare-cleaner-0.1.59 node_modules/lodash/_baseMerge.js
immosquare-cleaner-0.1.58 node_modules/lodash/_baseMerge.js
immosquare-cleaner-0.1.57 node_modules/lodash/_baseMerge.js
immosquare-cleaner-0.1.56 node_modules/lodash/_baseMerge.js
immosquare-cleaner-0.1.55 node_modules/lodash/_baseMerge.js
immosquare-cleaner-0.1.54 node_modules/lodash/_baseMerge.js
immosquare-cleaner-0.1.53 node_modules/lodash/_baseMerge.js
immosquare-cleaner-0.1.52 node_modules/lodash/_baseMerge.js
trusty-cms-6.3.1 node_modules/lodash/_baseMerge.js
immosquare-cleaner-0.1.51 node_modules/lodash/_baseMerge.js
boring_generators-0.15.0 tmp/templates/app_template/node_modules/lodash/_baseMerge.js
clapton-0.0.26 lib/clapton/javascripts/node_modules/lodash/_baseMerge.js
clapton-0.0.25 lib/clapton/javascripts/node_modules/lodash/_baseMerge.js
immosquare-cleaner-0.1.50 node_modules/lodash/_baseMerge.js
clapton-0.0.24 lib/clapton/javascripts/node_modules/lodash/_baseMerge.js
clapton-0.0.23 lib/clapton/javascripts/node_modules/lodash/_baseMerge.js
clapton-0.0.22 lib/clapton/javascripts/node_modules/lodash/_baseMerge.js
clapton-0.0.21 lib/clapton/javascripts/node_modules/lodash/_baseMerge.js
clapton-0.0.20 lib/clapton/javascripts/node_modules/lodash/_baseMerge.js