From 0d8291611f243ab925be9871154ab77ce93fbe3e Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sun, 3 Feb 2019 00:11:31 -0800 Subject: [PATCH] [Fix] `utils.merge`: avoid a crash with a null target and an array source --- test/utils.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/utils.js b/test/utils.js index 67ef9369..3c7ee523 100644 --- a/test/utils.js +++ b/test/utils.js @@ -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' } });