x/lodash/assignIn.js
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859import assignValue from './_assignValue.js';import copyObject from './_copyObject.js';import createAssigner from './_createAssigner.js';import isArrayLike from './isArrayLike.js';import isPrototype from './_isPrototype.js';import keysIn from './keysIn.js';/** Used for built-in method references. */var objectProto = Object.prototype;/** Built-in value references. */var propertyIsEnumerable = objectProto.propertyIsEnumerable;/** Detect if properties shadowing those on `Object.prototype` are non-enumerable. */var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf');/** * This method is like `_.assign` except that it iterates over own and * inherited source properties. * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @since 4.0.0 * @alias extend * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. * @returns {Object} Returns `object`. * @see _.assign * @example * * function Foo() { * this.a = 1; * } * * function Bar() { * this.c = 3; * } * * Foo.prototype.b = 2; * Bar.prototype.d = 4; * * _.assignIn({ 'a': 0 }, new Foo, new Bar); * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 } */var assignIn = createAssigner(function(object, source) { if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) { copyObject(source, keysIn(source), object); return; } for (var key in source) { assignValue(object, key, source[key]); }});export default assignIn;