Ensure _.mergeWith overwrites primitives with source object clones. [closes #1880]

This commit is contained in:
John-David Dalton
2016-01-25 20:09:17 -08:00
parent 8a7fce41bb
commit 8048f015e5
2 changed files with 13 additions and 1 deletions

View File

@@ -13528,6 +13528,16 @@
assert.deepEqual(actual, { 'a': { 'b': [0, 1, 2] } });
});
QUnit.test('should overwrite primitives with source object clones', function(assert) {
assert.expect(1);
var actual = _.mergeWith({ 'a': 0 }, { 'a': { 'b': ['c'] } }, function(a, b) {
return lodashStable.isArray(a) ? a.concat(b) : undefined;
});
assert.deepEqual(actual, { 'a': { 'b': ['c'] } });
});
}());
/*--------------------------------------------------------------------------*/