Skip to content

Commit

Permalink
fix: pass merge array deeply
Browse files Browse the repository at this point in the history
  • Loading branch information
aadityataparia committed May 30, 2019
1 parent 3ea094a commit d1296a6
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
7 changes: 3 additions & 4 deletions dist/sifrr.dev.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/sifrr.dev.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/sifrr.dev.module.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/sifrr.dev.module.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/deepmerge.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function deepMerge(target, merger, mergeArray = false) {
return mergeArray ? [...target, ...merger] : [...merger];
case 'object':
Object.keys(merger).forEach(k => {
target[k] = deepMerge(target[k], merger[k]);
target[k] = deepMerge(target[k], merger[k], mergeArray);
});
return target;
default:
Expand Down
2 changes: 1 addition & 1 deletion src/eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ module.exports = {
],
'max-lines': [
'error',
220 // Change to 200 after refactoring API.Model
220
],
'mocha/no-exclusive-tests': 'error'
},
Expand Down
5 changes: 3 additions & 2 deletions test/unit/deepmerge.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ describe('deepMerge', () => {
});
});

it('merges arrays', () => {
expect(deepMerge({ a: ['b'] }, { a: ['ok', 'haha'] })).to.deep.equal({ a: ['b', 'ok', 'haha'] });
it('merges arrays when asked', () => {
expect(deepMerge({ a: ['b'] }, { a: ['ok', 'haha'] })).to.deep.equal({ a: ['ok', 'haha'] });
expect(deepMerge({ a: ['b'] }, { a: ['ok', 'haha'] }, true)).to.deep.equal({ a: ['b', 'ok', 'haha'] });
});
});
2 changes: 1 addition & 1 deletion test/unit/dev.test.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
const dev = require('../../src/dev');
const dev = require('../../src/sifrr.dev');

0 comments on commit d1296a6

Please sign in to comment.