mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 08:07:50 +00:00
Ensure _.merge doesn't convert strings to arrays. [closes #1375]
This commit is contained in:
@@ -10258,7 +10258,7 @@
|
||||
deepEqual(actual, expected);
|
||||
});
|
||||
|
||||
test('should convert values to an array when merging with arrays of `source`', 2, function() {
|
||||
test('should convert values to arrays when merging with arrays of `source`', 2, function() {
|
||||
var object = { 'a': { '1': 'y', 'b': 'z', 'length': 2 } },
|
||||
actual = _.merge(object, { 'a': ['x'] });
|
||||
|
||||
@@ -10268,6 +10268,13 @@
|
||||
deepEqual(actual, { 'a': [] });
|
||||
});
|
||||
|
||||
test('should not convert strings to arrays when merging with arrays of `source`', 1, function() {
|
||||
var object = { 'a': 'abcdef' },
|
||||
actual = _.merge(object, { 'a': ['x', 'y', 'z'] });
|
||||
|
||||
deepEqual(actual, { 'a': ['x', 'y', 'z'] });
|
||||
});
|
||||
|
||||
test('should work with a function for `object`', 2, function() {
|
||||
function Foo() {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user