mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 23:57:49 +00:00
Update _.assign and _.assignIn fast paths.
This commit is contained in:
22
lodash.js
22
lodash.js
@@ -10843,6 +10843,10 @@
|
||||
* // => { 'a': 1, 'c': 3, 'e': 5 }
|
||||
*/
|
||||
var assign = createAssigner(function(object, source) {
|
||||
if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) {
|
||||
copyObject(source, keys(source), object);
|
||||
return;
|
||||
}
|
||||
for (var key in source) {
|
||||
if (hasOwnProperty.call(source, key)) {
|
||||
assignValue(object, key, source[key]);
|
||||
@@ -10850,13 +10854,6 @@
|
||||
}
|
||||
});
|
||||
|
||||
// Slow path for IE < 9.
|
||||
if (nonEnumShadows) {
|
||||
assign = createAssigner(function(object, source) {
|
||||
copyObject(source, keys(source), object);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is like `_.assign` except that it iterates over own and
|
||||
* inherited source properties.
|
||||
@@ -10887,18 +10884,15 @@
|
||||
* // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5 }
|
||||
*/
|
||||
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]);
|
||||
}
|
||||
});
|
||||
|
||||
// Slow path for IE < 9.
|
||||
if (nonEnumShadows) {
|
||||
assignIn = createAssigner(function(object, source) {
|
||||
copyObject(source, keysIn(source), object);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is like `_.assignIn` except that it accepts `customizer` which
|
||||
* is invoked to produce the assigned values. If `customizer` returns `undefined`
|
||||
|
||||
Reference in New Issue
Block a user