mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 18:37:50 +00:00
Add fp.invokeArgs.
This commit is contained in:
@@ -70,11 +70,11 @@ exports.aryMethod = {
|
|||||||
],
|
],
|
||||||
'3': [
|
'3': [
|
||||||
'assignInWith', 'assignWith', 'clamp', 'differenceBy', 'differenceWith',
|
'assignInWith', 'assignWith', 'clamp', 'differenceBy', 'differenceWith',
|
||||||
'getOr', 'inRange', 'intersectionBy', 'intersectionWith', 'isEqualWith',
|
'getOr', 'inRange', 'intersectionBy', 'intersectionWith', 'invokeArgs',
|
||||||
'isMatchWith', 'flatMapDepth', 'mergeWith', 'orderBy', 'pullAllBy',
|
'isEqualWith', 'isMatchWith', 'flatMapDepth', 'mergeWith', 'orderBy',
|
||||||
'pullAllWith', 'reduce', 'reduceRight', 'replace', 'set', 'slice',
|
'pullAllBy', 'pullAllWith', 'reduce', 'reduceRight', 'replace', 'set',
|
||||||
'sortedIndexBy', 'sortedLastIndexBy', 'transform', 'unionBy', 'unionWith',
|
'slice', 'sortedIndexBy', 'sortedLastIndexBy', 'transform', 'unionBy',
|
||||||
'update', 'xorBy', 'xorWith', 'zipWith'
|
'unionWith', 'update', 'xorBy', 'xorWith', 'zipWith'
|
||||||
],
|
],
|
||||||
'4': [
|
'4': [
|
||||||
'fill', 'setWith', 'updateWith'
|
'fill', 'setWith', 'updateWith'
|
||||||
@@ -140,6 +140,7 @@ exports.methodRearg = {
|
|||||||
'assignInWith': [1, 2, 0],
|
'assignInWith': [1, 2, 0],
|
||||||
'assignWith': [1, 2, 0],
|
'assignWith': [1, 2, 0],
|
||||||
'getOr': [2, 1, 0],
|
'getOr': [2, 1, 0],
|
||||||
|
'invokeArgs': [1, 0, 2],
|
||||||
'isMatchWith': [2, 1, 0],
|
'isMatchWith': [2, 1, 0],
|
||||||
'mergeWith': [1, 2, 0],
|
'mergeWith': [1, 2, 0],
|
||||||
'pullAllBy': [2, 1, 0],
|
'pullAllBy': [2, 1, 0],
|
||||||
@@ -153,6 +154,7 @@ exports.methodRearg = {
|
|||||||
|
|
||||||
/** Used to map method names to spread configs. */
|
/** Used to map method names to spread configs. */
|
||||||
exports.methodSpread = {
|
exports.methodSpread = {
|
||||||
|
'invokeArgs': 2,
|
||||||
'partial': 1,
|
'partial': 1,
|
||||||
'partialRight': 1
|
'partialRight': 1
|
||||||
};
|
};
|
||||||
@@ -220,6 +222,7 @@ exports.remap = {
|
|||||||
'curryN': 'curry',
|
'curryN': 'curry',
|
||||||
'curryRightN': 'curryRight',
|
'curryRightN': 'curryRight',
|
||||||
'getOr': 'get',
|
'getOr': 'get',
|
||||||
|
'invokeArgs': 'invoke',
|
||||||
'restFrom': 'rest',
|
'restFrom': 'rest',
|
||||||
'spreadFrom': 'spread',
|
'spreadFrom': 'spread',
|
||||||
'trimChars': 'trim',
|
'trimChars': 'trim',
|
||||||
|
|||||||
@@ -393,8 +393,9 @@
|
|||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
var funcMethods = [
|
var funcMethods = [
|
||||||
'after', 'ary', 'before', 'bind', 'bindKey', 'curryN', 'debounce', 'delay',
|
'after', 'ary', 'before', 'bind', 'bindKey', 'curryN', 'debounce',
|
||||||
'overArgs', 'partial', 'partialRight', 'rearg', 'throttle', 'wrap'
|
'delay', 'overArgs', 'partial', 'partialRight', 'rearg', 'throttle',
|
||||||
|
'wrap'
|
||||||
];
|
];
|
||||||
|
|
||||||
var exceptions = _.difference(funcMethods.concat('matchesProperty'), ['cloneDeepWith', 'cloneWith', 'delay']),
|
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');
|
QUnit.module('fp.iteratee');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user