MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / baseMerge

Function baseMerge

lib/web/jshint.js:3909–3943  ·  view source on GitHub ↗

* The base implementation of `_.merge` without support for argument juggling, * multiple sources, and `this` binding `customizer` functions. * * @private * @param {Object} object The destination object. * @param {Object} source The source object. * @param {Function} [cu

(object, source, customizer, stackA, stackB)

Source from the content-addressed store, hash-verified

3907 * @returns {Object} Returns `object`.
3908 */
3909 function baseMerge(object, source, customizer, stackA, stackB) {
3910 if (!isObject(object)) {
3911 return object;
3912 }
3913 var isSrcArr = isLength(source.length) && (isArray(source) || isTypedArray(source));
3914 if (!isSrcArr) {
3915 var props = keys(source);
3916 push.apply(props, getSymbols(source));
3917 }
3918 arrayEach(props || source, function(srcValue, key) {
3919 if (props) {
3920 key = srcValue;
3921 srcValue = source[key];
3922 }
3923 if (isObjectLike(srcValue)) {
3924 stackA || (stackA = []);
3925 stackB || (stackB = []);
3926 baseMergeDeep(object, source, key, baseMerge, customizer, stackA, stackB);
3927 }
3928 else {
3929 var value = object[key],
3930 result = customizer ? customizer(value, srcValue, key, object, source) : undefined,
3931 isCommon = result === undefined;
3932
3933 if (isCommon) {
3934 result = srcValue;
3935 }
3936 if ((isSrcArr || result !== undefined) &&
3937 (isCommon || (result === result ? (result !== value) : (value === value)))) {
3938 object[key] = result;
3939 }
3940 }
3941 });
3942 return object;
3943 }
3944
3945 /**
3946 * A specialized version of `baseMerge` for arrays and objects which performs

Callers

nothing calls this directly

Calls 8

isLengthFunction · 0.85
isTypedArrayFunction · 0.85
arrayEachFunction · 0.85
isObjectLikeFunction · 0.85
baseMergeDeepFunction · 0.85
isObjectFunction · 0.70
isArrayFunction · 0.70
applyMethod · 0.65

Tested by

no test coverage detected