Ensure _.defaultsDeep does not overwrite regexp values.

This commit is contained in:
John-David Dalton
2016-02-27 14:35:20 -08:00
parent 2e790fb865
commit 63f8b1dcec
2 changed files with 14 additions and 3 deletions

View File

@@ -4350,6 +4350,16 @@
assert.strictEqual(actual.a.b, null);
});
QUnit.test('should not overwrite regexp values', function(assert) {
assert.expect(1);
var object = { 'a': { 'b': /x/ } },
source = { 'a': { 'b': /y/ } },
actual = _.defaultsDeep(object, source);
assert.deepEqual(actual.a.b, /x/);
});
QUnit.test('should not convert function properties to objects', function(assert) {
assert.expect(2);