mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 23:57:49 +00:00
Add fp.restFrom and fp.spreadFrom.
This commit is contained in:
@@ -59,13 +59,14 @@ exports.aryMethod = {
|
||||
'map', 'mapKeys', 'mapValues', 'matchesProperty', 'maxBy', 'merge', 'minBy',
|
||||
'omit', 'omitBy', 'overArgs', 'pad', 'padEnd', 'padStart', 'parseInt', 'partial',
|
||||
'partialRight', 'partition', 'pick', 'pickBy', 'pull', 'pullAll', 'pullAt',
|
||||
'random', 'range', 'rangeRight', 'rearg', 'reject', 'remove', 'repeat', 'result',
|
||||
'sampleSize', 'some', 'sortBy', 'sortedIndex', 'sortedIndexOf', 'sortedLastIndex',
|
||||
'sortedLastIndexOf', 'sortedUniqBy', 'split', 'startsWith', 'subtract', 'sumBy',
|
||||
'take', 'takeRight', 'takeRightWhile', 'takeWhile', 'tap', 'throttle', 'thru',
|
||||
'times', 'trimChars', 'trimCharsEnd', 'trimCharsStart', 'truncate', 'union',
|
||||
'uniqBy', 'uniqWith', 'unset', 'unzipWith', 'without', 'wrap', 'xor', 'zip',
|
||||
'zipObject', 'zipObjectDeep'
|
||||
'random', 'range', 'rangeRight', 'rearg', 'reject', 'remove', 'repeat',
|
||||
'restFrom', 'result', 'sampleSize', 'some', 'sortBy', 'sortedIndex',
|
||||
'sortedIndexOf', 'sortedLastIndex', 'sortedLastIndexOf', 'sortedUniqBy',
|
||||
'split', 'spreadFrom', 'startsWith', 'subtract', 'sumBy', 'take', 'takeRight',
|
||||
'takeRightWhile', 'takeWhile', 'tap', 'throttle', 'thru', 'times', 'trimChars',
|
||||
'trimCharsEnd', 'trimCharsStart', 'truncate', 'union', 'uniqBy', 'uniqWith',
|
||||
'unset', 'unzipWith', 'without', 'wrap', 'xor', 'zip', 'zipObject',
|
||||
'zipObjectDeep'
|
||||
],
|
||||
'3': [
|
||||
'assignInWith', 'assignWith', 'clamp', 'differenceBy', 'differenceWith',
|
||||
@@ -219,6 +220,8 @@ exports.remap = {
|
||||
'curryN': 'curry',
|
||||
'curryRightN': 'curryRight',
|
||||
'getOr': 'get',
|
||||
'restFrom': 'rest',
|
||||
'spreadFrom': 'spread',
|
||||
'trimChars': 'trim',
|
||||
'trimCharsEnd': 'trimEnd',
|
||||
'trimCharsStart': 'trimStart'
|
||||
|
||||
@@ -1447,6 +1447,22 @@
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('fp.restFrom');
|
||||
|
||||
(function() {
|
||||
QUnit.test('should accept a `start` param', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
var actual = fp.restFrom(2)(function() {
|
||||
return slice.call(arguments);
|
||||
})('a', 'b', 'c', 'd');
|
||||
|
||||
assert.deepEqual(actual, ['a', 'b', ['c', 'd']]);
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('fp.runInContext');
|
||||
|
||||
(function() {
|
||||
@@ -1466,6 +1482,22 @@
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('fp.spreadFrom');
|
||||
|
||||
(function() {
|
||||
QUnit.test('should accept a `start` param', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
var actual = fp.spreadFrom(2)(function() {
|
||||
return slice.call(arguments);
|
||||
})('a', 'b', ['c', 'd']);
|
||||
|
||||
assert.deepEqual(actual, ['a', 'b', 'c', 'd']);
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('fp.trimChars');
|
||||
|
||||
_.each(['trimChars', 'trimCharsStart', 'trimCharsEnd'], function(methodName, index) {
|
||||
|
||||
Reference in New Issue
Block a user