diff --git a/fp/_mapping.js b/fp/_mapping.js index 26bde3856..b69e2efb4 100644 --- a/fp/_mapping.js +++ b/fp/_mapping.js @@ -70,11 +70,11 @@ exports.aryMethod = { ], '3': [ 'assignInWith', 'assignWith', 'clamp', 'differenceBy', 'differenceWith', - 'getOr', 'inRange', 'intersectionBy', 'intersectionWith', 'isEqualWith', - 'isMatchWith', 'flatMapDepth', 'mergeWith', 'orderBy', 'pullAllBy', - 'pullAllWith', 'reduce', 'reduceRight', 'replace', 'set', 'slice', - 'sortedIndexBy', 'sortedLastIndexBy', 'transform', 'unionBy', 'unionWith', - 'update', 'xorBy', 'xorWith', 'zipWith' + 'getOr', 'inRange', 'intersectionBy', 'intersectionWith', 'invokeArgs', + 'isEqualWith', 'isMatchWith', 'flatMapDepth', 'mergeWith', 'orderBy', + 'pullAllBy', 'pullAllWith', 'reduce', 'reduceRight', 'replace', 'set', + 'slice', 'sortedIndexBy', 'sortedLastIndexBy', 'transform', 'unionBy', + 'unionWith', 'update', 'xorBy', 'xorWith', 'zipWith' ], '4': [ 'fill', 'setWith', 'updateWith' @@ -140,6 +140,7 @@ exports.methodRearg = { 'assignInWith': [1, 2, 0], 'assignWith': [1, 2, 0], 'getOr': [2, 1, 0], + 'invokeArgs': [1, 0, 2], 'isMatchWith': [2, 1, 0], 'mergeWith': [1, 2, 0], 'pullAllBy': [2, 1, 0], @@ -153,6 +154,7 @@ exports.methodRearg = { /** Used to map method names to spread configs. */ exports.methodSpread = { + 'invokeArgs': 2, 'partial': 1, 'partialRight': 1 }; @@ -220,6 +222,7 @@ exports.remap = { 'curryN': 'curry', 'curryRightN': 'curryRight', 'getOr': 'get', + 'invokeArgs': 'invoke', 'restFrom': 'rest', 'spreadFrom': 'spread', 'trimChars': 'trim', diff --git a/test/test-fp.js b/test/test-fp.js index 8f9adccbb..6dc10b03b 100644 --- a/test/test-fp.js +++ b/test/test-fp.js @@ -393,8 +393,9 @@ assert.expect(1); var funcMethods = [ - 'after', 'ary', 'before', 'bind', 'bindKey', 'curryN', 'debounce', 'delay', - 'overArgs', 'partial', 'partialRight', 'rearg', 'throttle', 'wrap' + 'after', 'ary', 'before', 'bind', 'bindKey', 'curryN', 'debounce', + 'delay', 'overArgs', 'partial', 'partialRight', 'rearg', 'throttle', + 'wrap' ]; var exceptions = _.difference(funcMethods.concat('matchesProperty'), ['cloneDeepWith', 'cloneWith', 'delay']), @@ -1143,6 +1144,32 @@ /*--------------------------------------------------------------------------*/ + QUnit.module('fp.invoke'); + + (function() { + QUnit.test('should not accept an `args` param', function(assert) { + assert.expect(1); + + var actual = fp.invoke('toUpperCase')('a'); + assert.strictEqual(actual, 'A'); + }); + }()); + + /*--------------------------------------------------------------------------*/ + + QUnit.module('fp.invokeArgs'); + + (function() { + QUnit.test('should accept an `args` param', function(assert) { + assert.expect(1); + + var actual = fp.invokeArgs('concat')('a')(['b', 'c']); + assert.strictEqual(actual, 'abc'); + }); + }()); + + /*--------------------------------------------------------------------------*/ + QUnit.module('fp.iteratee'); (function() {