Add fp.invokeArgs.

This commit is contained in:
John-David Dalton
2016-03-13 16:20:12 -07:00
parent f3279b7ee1
commit 65fd579ed2
2 changed files with 37 additions and 7 deletions

View File

@@ -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',

View File

@@ -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() {