Skip to content

Commit

Permalink
[Fix] utils.merge: avoid a crash with a null target and an array so…
Browse files Browse the repository at this point in the history
…urce
  • Loading branch information
ljharb committed Feb 3, 2019
1 parent c103b90 commit 0d82916
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ var utils = require('../lib/utils');
test('merge()', function (t) {
t.deepEqual(utils.merge(null, true), [null, true], 'merges true into null');

t.deepEqual(utils.merge(null, [42]), [null, 42], 'merges null into an array');

t.deepEqual(utils.merge({ a: 'b' }, { a: 'c' }), { a: ['b', 'c'] }, 'merges two objects with the same key');

var oneMerged = utils.merge({ foo: 'bar' }, { foo: { first: '123' } });
Expand Down

0 comments on commit 0d82916

Please # to comment.