We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 11e5dd5 commit c39b161Copy full SHA for c39b161
test.js
@@ -134,4 +134,16 @@ describe('mergeDeep', function() {
134
var actual = merge(fixture);
135
assert.deepEqual(actual, fixture);
136
});
137
+
138
+ it('should not clone invalid keys', function() {
139
+ var obj1 = { a: { b: 1 } };
140
+ var obj2 = JSON.parse('{ "a": { "c": 2 }, "constructor": { "keys": 42 } }');
141
142
+ var actual = merge({}, obj1, obj2);
143
+ assert.deepEqual(actual, { a: { b: 1, c: 2 } });
144
+ assert.notDeepEqual(actual.a, obj1.a);
145
+ assert.notDeepEqual(actual.a, obj2.a);
146
+ assert.notEqual(actual.keys, 42);
147
+ assert.notEqual(actual.constructor.keys, 42);
148
+ });
149
0 commit comments