diff --git a/index.js b/index.js index b33cfb5..67c1b39 100644 --- a/index.js +++ b/index.js @@ -51,8 +51,8 @@ function deepmerge(target, source, optionsArgument) { } deepmerge.all = function deepmergeAll(array, optionsArgument) { - if (!Array.isArray(array) || array.length < 1) { - throw new Error('first argument should be an array with at least one element') + if (!Array.isArray(array)) { + throw new Error('first argument should be an array') } return array.reduce(function(prev, next) { diff --git a/test/merge-all.js b/test/merge-all.js index 9254a55..5d64bd4 100644 --- a/test/merge-all.js +++ b/test/merge-all.js @@ -6,8 +6,8 @@ test('throw error if first argument is not an array', function(t) { t.end() }) -test('throw error if first argument is an array with no elements', function(t) { - t.throws(merge.all.bind(null, []), Error) +test('return an empty object if first argument is an array with no elements', function(t) { + t.deepEqual(merge.all([]), {}) t.end() })