mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 17:07:49 +00:00
Bump to v4.6.0.
This commit is contained in:
14
assignIn.js
14
assignIn.js
@@ -1,7 +1,13 @@
|
||||
import assignValue from './_assignValue';
|
||||
import copyObject from './_copyObject';
|
||||
import createAssigner from './_createAssigner';
|
||||
import isArrayLike from './isArrayLike';
|
||||
import isPrototype from './_isPrototype';
|
||||
import keysIn from './keysIn';
|
||||
|
||||
/** Detect if properties shadowing those on `Object.prototype` are non-enumerable. */
|
||||
var nonEnumShadows = !({ 'valueOf': 1 }).propertyIsEnumerable('valueOf');
|
||||
|
||||
/**
|
||||
* This method is like `_.assign` except that it iterates over own and
|
||||
* inherited source properties.
|
||||
@@ -32,7 +38,13 @@ import keysIn from './keysIn';
|
||||
* // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5 }
|
||||
*/
|
||||
var assignIn = createAssigner(function(object, source) {
|
||||
copyObject(source, keysIn(source), object);
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user