import Stack from "./_Stack.mjs";
import assignMergeValue from "./_assignMergeValue.mjs";
import baseFor from "./_baseFor.mjs";
import baseMergeDeep from "./_baseMergeDeep.mjs";
import isObject from "./isObject.mjs";
import keysIn from "./keysIn.mjs";
import safeGet from "./_safeGet.mjs";
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) : void 0;
      if (newValue === void 0) {
        newValue = srcValue;
      }
      assignMergeValue(object, key, newValue);
    }
  }, keysIn);
}
export {
  baseMerge as default
};
