mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 02:17:50 +00:00
Ensure curryN, curryRightN, curryRight, and sampleSize are defined.
This commit is contained in:
committed by
John-David Dalton
parent
e3c79bd24a
commit
44c697908b
@@ -73,11 +73,11 @@ module.exports = {
|
|||||||
/** Used to map ary to method names. */
|
/** Used to map ary to method names. */
|
||||||
'aryMethodMap': {
|
'aryMethodMap': {
|
||||||
1: (
|
1: (
|
||||||
'attempt,ceil,create,curry,floor,fromPairs,iteratee,invert,over,overEvery,' +
|
'attempt,ceil,create,curry,curryRight,floor,fromPairs,iteratee,invert,over,overEvery,' +
|
||||||
'overSome,memoize,method,methodOf,mixin,rest,reverse,round,runInContext,template,' +
|
'overSome,memoize,method,methodOf,mixin,rest,reverse,round,runInContext,template,' +
|
||||||
'trim,trimLeft,trimRight,uniqueId,words').split(','),
|
'trim,trimLeft,trimRight,uniqueId,words').split(','),
|
||||||
2: (
|
2: (
|
||||||
'add,ary,assign,at,bind,bindKey,cloneDeepWith,cloneWith,concat,countBy,curryN,' +
|
'add,ary,assign,at,bind,bindKey,cloneDeepWith,cloneWith,concat,countBy,curryN,curryRightN,' +
|
||||||
'debounce,defaults,defaultsDeep,delay,difference,drop,dropRight,dropRightWhile,' +
|
'debounce,defaults,defaultsDeep,delay,difference,drop,dropRight,dropRightWhile,' +
|
||||||
'dropWhile,endsWith,every,extend,filter,find,find,findIndex,findKey,findLast,' +
|
'dropWhile,endsWith,every,extend,filter,find,find,findIndex,findKey,findLast,' +
|
||||||
'findLastIndex,findLastKey,flatMap,forEach,forEachRight,forIn,forInRight,' +
|
'findLastIndex,findLastKey,flatMap,forEach,forEachRight,forIn,forInRight,' +
|
||||||
@@ -120,7 +120,8 @@ module.exports = {
|
|||||||
'keyMap': {
|
'keyMap': {
|
||||||
'curryN': 'curry',
|
'curryN': 'curry',
|
||||||
'curryRightN': 'curryRight',
|
'curryRightN': 'curryRight',
|
||||||
'getOr': 'get'
|
'getOr': 'get',
|
||||||
|
'sampleSize': 'sample'
|
||||||
},
|
},
|
||||||
|
|
||||||
/** Used to identify methods which mutate arrays or objects. */
|
/** Used to identify methods which mutate arrays or objects. */
|
||||||
|
|||||||
@@ -321,6 +321,45 @@
|
|||||||
var actual = fp.curryN(1, function(a, b) { return [a, b]; })('a');
|
var actual = fp.curryN(1, function(a, b) { return [a, b]; })('a');
|
||||||
assert.deepEqual(actual, ['a', undefined]);
|
assert.deepEqual(actual, ['a', undefined]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
QUnit.test('should only pass in `arity` number of arguments', function(assert) {
|
||||||
|
assert.expect(1);
|
||||||
|
|
||||||
|
var actual = fp.curryN(1, function(a, b) { return [a, b]; })('a', 'b');
|
||||||
|
assert.deepEqual(actual, ['a', undefined]);
|
||||||
|
});
|
||||||
|
}());
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
QUnit.module('fp.curryRight');
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
QUnit.test('should accept only a `func` param', function(assert) {
|
||||||
|
assert.expect(1);
|
||||||
|
|
||||||
|
assert.raises(function() { fp.curryRight(1, _.noop); }, TypeError);
|
||||||
|
});
|
||||||
|
}());
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
QUnit.module('fp.curryRightN');
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
QUnit.test('should accept an `arity` param', function(assert) {
|
||||||
|
assert.expect(1);
|
||||||
|
|
||||||
|
var actual = fp.curryRightN(1, function(a, b) { return [a, b]; })('a');
|
||||||
|
assert.deepEqual(actual, ['a', undefined]);
|
||||||
|
});
|
||||||
|
|
||||||
|
QUnit.test('should only pass in `arity` number of arguments', function(assert) {
|
||||||
|
assert.expect(1);
|
||||||
|
|
||||||
|
var actual = fp.curryRightN(1, function(a, b) { return [a, b]; })('a', 'b');
|
||||||
|
assert.deepEqual(actual, ['a', undefined]);
|
||||||
|
});
|
||||||
}());
|
}());
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|||||||
Reference in New Issue
Block a user