mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-11 03:17:49 +00:00
reverting an old change -- _.extend should absolutely copy undefined values.
This commit is contained in:
@@ -38,7 +38,7 @@ $(document).ready(function() {
|
|||||||
result = _.extend({x:'x'}, {a:'a', x:2}, {a:'b'});
|
result = _.extend({x:'x'}, {a:'a', x:2}, {a:'b'});
|
||||||
ok(_.isEqual(result, {x:2, a:'b'}), 'extending from multiple source objects last property trumps');
|
ok(_.isEqual(result, {x:2, a:'b'}), 'extending from multiple source objects last property trumps');
|
||||||
result = _.extend({}, {a: void 0, b: null});
|
result = _.extend({}, {a: void 0, b: null});
|
||||||
equals(_.keys(result).join(''), 'b', 'extend does not copy undefined values');
|
equals(_.keys(result).join(''), 'ab', 'extend does not copy undefined values');
|
||||||
});
|
});
|
||||||
|
|
||||||
test("objects: defaults", function() {
|
test("objects: defaults", function() {
|
||||||
|
|||||||
@@ -635,7 +635,7 @@
|
|||||||
_.extend = function(obj) {
|
_.extend = function(obj) {
|
||||||
each(slice.call(arguments, 1), function(source) {
|
each(slice.call(arguments, 1), function(source) {
|
||||||
for (var prop in source) {
|
for (var prop in source) {
|
||||||
if (source[prop] !== void 0) obj[prop] = source[prop];
|
obj[prop] = source[prop];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return obj;
|
return obj;
|
||||||
|
|||||||
Reference in New Issue
Block a user