10000 Ensure `_.merge` passes the right arguments to the `callback` when co… · lodash/lodash@ad0c287 · GitHub
[go: up one dir, main page]

Skip to content

Commit ad0c287

Browse files
committed
Ensure _.merge passes the right arguments to the callback when comparing objects. [closes #231]
Former-commit-id: 7c1ff861f753d3a2bdf62a753c94df2052d03d78
1 parent 4a11a35 commit ad0c287

File tree

7 files changed

+115
-91
lines changed

7 files changed

+115
-91
lines changed

dist/lodash.compat.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2029,17 +2029,18 @@
20292029
}
20302030
}
20312031
if (!found) {
2032-
value = isArr
2033-
? (isArray(value) ? value : [])
2034-
: (isPlainObject(value) ? value : {});
2035-
20362032
var isShallow;
20372033
if (callback) {
20382034
result = callback(value, source);
20392035
if ((isShallow = typeof result != 'undefined')) {
20402036
value = result;
20412037
}
20422038
}
2039+
if (!isShallow) {
2040+
value = isArr
2041+
? (isArray(value) ? value : [])
2042+
: (isPlainObject(value) ? value : {});
2043+
}
20432044
// add `source` and associated `value` to the stack of traversed objects
20442045
stackA.push(source);
20452046
stackB.push(value);

dist/lodash.compat.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/lodash.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1820,17 +1820,18 @@
18201820
}
18211821
}
18221822
if (!found) {
1823-
value = isArr
1824-
? (isArray(value) ? value : [])
1825-
: (isPlainObject(value) ? value : {});
1826-
18271823
var isShallow;
18281824
if (callback) {
18291825
result = callback(value, source);
18301826
if ((isShallow = typeof result != 'undefined')) {
18311827
value = result;
18321828
}
18331829
}
1830+
if (!isShallow) {
1831+
value = isArr
1832+
? (isArray(value) ? value : [])
1833+
: (isPlainObject(value) ? value : {});
1834+
}
18341835
// add `source` and associated `value` to the stack of traversed objects
18351836
stackA.push(source);
18361837
stackB.push(value);

dist/lodash.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
0