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.26 node_modules/lodash/_baseMerge.js
immosquare-cleaner-0.1.25 node_modules/lodash/_baseMerge.js
immosquare-cleaner-0.1.24 node_modules/lodash/_baseMerge.js
immosquare-cleaner-0.1.23 node_modules/lodash/_baseMerge.js
reed_sdk-1.0.1 node_modules/lodash/_baseMerge.js
reed_sdk-1.0.0 node_modules/lodash/_baseMerge.js
boring_generators-0.12.0 tmp/templates/app_template/node_modules/lodash/_baseMerge.js
disco_app-0.18.0 test/dummy/node_modules/lodash/_baseMerge.js
disco_app-0.18.2 test/dummy/node_modules/lodash/_baseMerge.js
trusty-cms-5.0.7 node_modules/lodash/_baseMerge.js
appmap-0.72.2 ./node_modules/lodash/_baseMerge.js
trusty-cms-5.0.6 node_modules/lodash/_baseMerge.js
appmap-0.72.1 ./node_modules/lodash/_baseMerge.js
appmap-0.72.0 ./node_modules/lodash/_baseMerge.js
trusty-cms-5.0.5 node_modules/lodash/_baseMerge.js
trusty-cms-5.0.4 node_modules/lodash/_baseMerge.js
appmap-0.71.0 ./node_modules/lodash/_baseMerge.js
disco_app-0.16.1 test/dummy/node_modules/lodash/_baseMerge.js
appmap-0.70.2 ./node_modules/lodash/_baseMerge.js
appmap-0.70.1 ./node_modules/lodash/_baseMerge.js