From 1b3815928d5ada407e9ba6ec20ed4bb3af685e22 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Fri, 4 Nov 2016 01:10:54 -0700 Subject: [PATCH] Ensure `fp.mergeAllWith` accepts more than 2 sources. [closes #2786] --- fp/_mapping.js | 12 ++++++------ lodash.js | 1 + test/test.js | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/fp/_mapping.js b/fp/_mapping.js index 7fa8e672e..cbbcd99df 100644 --- a/fp/_mapping.js +++ b/fp/_mapping.js @@ -172,9 +172,9 @@ exports.iterateeRearg = { /** Used to map method names to rearg configs. */ exports.methodRearg = { - 'assignInAllWith': [1, 2, 0], + 'assignInAllWith': [1, 0], 'assignInWith': [1, 2, 0], - 'assignAllWith': [1, 2, 0], + 'assignAllWith': [1, 0], 'assignWith': [1, 2, 0], 'differenceBy': [1, 2, 0], 'differenceWith': [1, 2, 0], @@ -183,7 +183,7 @@ exports.methodRearg = { 'intersectionWith': [1, 2, 0], 'isEqualWith': [1, 2, 0], 'isMatchWith': [2, 1, 0], - 'mergeAllWith': [1, 2, 0], + 'mergeAllWith': [1, 0], 'mergeWith': [1, 2, 0], 'padChars': [2, 1, 0], 'padCharsEnd': [2, 1, 0], @@ -206,15 +206,15 @@ exports.methodRearg = { /** Used to map method names to spread configs. */ exports.methodSpread = { 'assignAll': { 'start': 0 }, - 'assignAllWith': { 'afterRearg': true, 'start': 1 }, + 'assignAllWith': { 'start': 0 }, 'assignInAll': { 'start': 0 }, - 'assignInAllWith': { 'afterRearg': true, 'start': 1 }, + 'assignInAllWith': { 'start': 0 }, 'defaultsAll': { 'start': 0 }, 'defaultsDeepAll': { 'start': 0 }, 'invokeArgs': { 'start': 2 }, 'invokeArgsMap': { 'start': 2 }, 'mergeAll': { 'start': 0 }, - 'mergeAllWith': { 'afterRearg': true, 'start': 1 }, + 'mergeAllWith': { 'start': 0 }, 'partial': { 'start': 1 }, 'partialRight': { 'start': 1 }, 'without': { 'start': 1 }, diff --git a/lodash.js b/lodash.js index 72f744fba..3e150d3fa 100644 --- a/lodash.js +++ b/lodash.js @@ -10822,6 +10822,7 @@ if (array) { arrayPush(otherArgs, array); } + arrayPush(otherArgs, castSlice(args, start + 1)); return apply(func, this, otherArgs); }); } diff --git a/test/test.js b/test/test.js index 417262fe3..621656000 100644 --- a/test/test.js +++ b/test/test.js @@ -20866,8 +20866,8 @@ args = slice.call(arguments); }); - spread([4, 2], 'ignored'); - assert.deepEqual(args, [4, 2]); + spread([1, 2], 3); + assert.deepEqual(args, [1, 2, 3]); }); QUnit.test('should work with `start`', function(assert) {