Skip to content

Commit

Permalink
small bug fix 🌛
Browse files Browse the repository at this point in the history
  • Loading branch information
mesqueeb committed Sep 22, 2018
1 parent 1a5f4f4 commit 65ed4b1
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion dist/index.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function mergeRecursively(origin, newComer, extensions) {


if (isWhat.isObject(newVal)) {
carry[key] = mergeRecursively(targetVal, newVal);
carry[key] = mergeRecursively(targetVal, newVal, extensions);
return carry;
} // all the rest

Expand Down
2 changes: 1 addition & 1 deletion dist/index.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function mergeRecursively(origin, newComer, extensions) {


if (isObject(newVal)) {
carry[key] = mergeRecursively(targetVal, newVal);
carry[key] = mergeRecursively(targetVal, newVal, extensions);
return carry;
} // all the rest

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "merge-anything",
"version": "2.0.0",
"version": "2.0.1",
"description": "Merge two objects recursively. A simple & small integration.",
"main": "dist/index.cjs.js",
"module": "dist/index.es.js",
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function mergeRecursively (origin, newComer, extensions) {
}
// When newVal is an object do the merge recursively
if (isObject(newVal)) {
carry[key] = mergeRecursively(targetVal, newVal)
carry[key] = mergeRecursively(targetVal, newVal, extensions)
return carry
}
// all the rest
Expand Down
9 changes: 6 additions & 3 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,16 @@ test('Extend concat arrays', t => {
extensions: [concatArrays]
}
origin = {
someArray: ['a']
someArray: ['a'],
a: {b: {c: ['x']}}
}
target = {
someArray: ['b']
someArray: ['b'],
a: {b: {c: ['y']}}
}
res = merge(extensions, origin, target)
t.deepEqual(res, {someArray: ['a', 'b']})
t.deepEqual(res, {someArray: ['a', 'b'], a: {b: {c: ['x', 'y']}}})
// also works on base lvl
res = merge(extensions, ['a'], ['b'])
t.deepEqual(res, ['a', 'b'])
})
Expand Down

0 comments on commit 65ed4b1

Please sign in to comment.