mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 10:27:49 +00:00
Remove fp caps mapping.
This commit is contained in:
@@ -65,6 +65,8 @@ function baseConvert(util, name, func, options) {
|
|||||||
rearg = helpers.rearg,
|
rearg = helpers.rearg,
|
||||||
spread = helpers.spread;
|
spread = helpers.spread;
|
||||||
|
|
||||||
|
var aryMethodKeys = keys(mapping.aryMethod);
|
||||||
|
|
||||||
var baseArity = function(func, n) {
|
var baseArity = function(func, n) {
|
||||||
return n == 2
|
return n == 2
|
||||||
? function(a, b) { return func.apply(undefined, arguments); }
|
? function(a, b) { return func.apply(undefined, arguments); }
|
||||||
@@ -210,8 +212,8 @@ function baseConvert(util, name, func, options) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
var result;
|
var result;
|
||||||
each(mapping.caps, function(cap) {
|
each(aryMethodKeys, function(aryKey) {
|
||||||
each(mapping.aryMethod[cap], function(otherName) {
|
each(mapping.aryMethod[aryKey], function(otherName) {
|
||||||
if (name == otherName) {
|
if (name == otherName) {
|
||||||
var aryN = !isLib && mapping.iterateeAry[name],
|
var aryN = !isLib && mapping.iterateeAry[name],
|
||||||
spreadStart = mapping.methodSpread[name];
|
spreadStart = mapping.methodSpread[name];
|
||||||
@@ -219,17 +221,17 @@ function baseConvert(util, name, func, options) {
|
|||||||
result = wrapped;
|
result = wrapped;
|
||||||
if (config.fixed) {
|
if (config.fixed) {
|
||||||
result = spreadStart === undefined
|
result = spreadStart === undefined
|
||||||
? ary(result, cap)
|
? ary(result, aryKey)
|
||||||
: spread(result, spreadStart);
|
: spread(result, spreadStart);
|
||||||
}
|
}
|
||||||
if (config.rearg && cap > 1 && (forceRearg || !mapping.skipRearg[name])) {
|
if (config.rearg && aryKey > 1 && (forceRearg || !mapping.skipRearg[name])) {
|
||||||
result = rearg(result, mapping.methodRearg[name] || mapping.aryRearg[cap]);
|
result = rearg(result, mapping.methodRearg[name] || mapping.aryRearg[aryKey]);
|
||||||
}
|
}
|
||||||
if (config.cap && aryN) {
|
if (config.cap && aryN) {
|
||||||
result = iterateeAry(result, aryN);
|
result = iterateeAry(result, aryN);
|
||||||
}
|
}
|
||||||
if (config.curry && cap > 1) {
|
if (config.curry && aryKey > 1) {
|
||||||
result = curry(result, cap);
|
result = curry(result, aryKey);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -252,8 +254,8 @@ function baseConvert(util, name, func, options) {
|
|||||||
|
|
||||||
// Iterate over methods for the current ary cap.
|
// Iterate over methods for the current ary cap.
|
||||||
var pairs = [];
|
var pairs = [];
|
||||||
each(mapping.caps, function(cap) {
|
each(aryMethodKeys, function(aryKey) {
|
||||||
each(mapping.aryMethod[cap], function(key) {
|
each(mapping.aryMethod[aryKey], function(key) {
|
||||||
var func = _[mapping.remap[key] || key];
|
var func = _[mapping.remap[key] || key];
|
||||||
if (func) {
|
if (func) {
|
||||||
pairs.push([key, wrap(key, func)]);
|
pairs.push([key, wrap(key, func)]);
|
||||||
|
|||||||
@@ -38,55 +38,52 @@ exports.aliasToReal = {
|
|||||||
|
|
||||||
/** Used to map ary to method names. */
|
/** Used to map ary to method names. */
|
||||||
exports.aryMethod = {
|
exports.aryMethod = {
|
||||||
1: [
|
'1': [
|
||||||
'attempt', 'castArray', 'ceil', 'create', 'curry', 'curryRight', 'floor',
|
'attempt', 'castArray', 'ceil', 'create', 'curry', 'curryRight', 'floor',
|
||||||
'fromPairs', 'invert', 'iteratee', 'memoize', 'method', 'methodOf', 'mixin',
|
'fromPairs', 'invert', 'iteratee', 'memoize', 'method', 'methodOf', 'mixin',
|
||||||
'over', 'overEvery', 'overSome', 'rest', 'reverse', 'round', 'runInContext',
|
'over', 'overEvery', 'overSome', 'rest', 'reverse', 'round', 'runInContext',
|
||||||
'spread', 'template', 'trim', 'trimEnd', 'trimStart', 'uniqueId', 'words'
|
'spread', 'template', 'trim', 'trimEnd', 'trimStart', 'uniqueId', 'words'
|
||||||
],
|
],
|
||||||
2: [
|
'2': [
|
||||||
'add', 'after', 'ary', 'assign', 'assignIn', 'at', 'before', 'bind', 'bindKey',
|
'add', 'after', 'ary', 'assign', 'assignIn', 'at', 'before', 'bind', 'bindKey',
|
||||||
'chunk', 'cloneDeepWith', 'cloneWith', 'concat', 'countBy', 'curryN',
|
'chunk', 'cloneDeepWith', 'cloneWith', 'concat', 'countBy', 'curryN',
|
||||||
'curryRightN', 'debounce', 'defaults', 'defaultsDeep', 'delay', 'difference',
|
'curryRightN', 'debounce', 'defaults', 'defaultsDeep', 'delay', 'difference',
|
||||||
'drop', 'dropRight', 'dropRightWhile', 'dropWhile', 'endsWith', 'eq', 'every',
|
'drop', 'dropRight', 'dropRightWhile', 'dropWhile', 'endsWith', 'eq', 'every',
|
||||||
'filter', 'find', 'find', 'findIndex', 'findKey', 'findLast', 'findLastIndex',
|
'filter', 'find', 'find', 'findIndex', 'findKey', 'findLast', 'findLastIndex',
|
||||||
'findLastKey', 'flatMap', 'flattenDepth', 'forEach', 'forEachRight', 'forIn',
|
'findLastKey', 'flatMap', 'flattenDepth', 'forEach', 'forEachRight', 'forIn',
|
||||||
'forInRight', 'forOwn', 'forOwnRight', 'get', 'groupBy', 'gt', 'gte', 'has',
|
'forInRight', 'forOwn', 'forOwnRight', 'get', 'groupBy', 'gt', 'gte', 'has',
|
||||||
'hasIn', 'includes', 'indexOf', 'intersection', 'invertBy', 'invoke', 'invokeMap',
|
'hasIn', 'includes', 'indexOf', 'intersection', 'invertBy', 'invoke', 'invokeMap',
|
||||||
'isEqual', 'isMatch', 'join', 'keyBy', 'lastIndexOf', 'lt', 'lte', 'map',
|
'isEqual', 'isMatch', 'join', 'keyBy', 'lastIndexOf', 'lt', 'lte', 'map',
|
||||||
'mapKeys', 'mapValues', 'matchesProperty', 'maxBy', 'merge', 'minBy', 'omit',
|
'mapKeys', 'mapValues', 'matchesProperty', 'maxBy', 'merge', 'minBy', 'omit',
|
||||||
'omitBy', 'orderBy', 'overArgs', 'pad', 'padEnd', 'padStart', 'parseInt',
|
'omitBy', 'orderBy', 'overArgs', 'pad', 'padEnd', 'padStart', 'parseInt',
|
||||||
'partial', 'partialRight', 'partition', 'pick', 'pickBy', 'pull', 'pullAll',
|
'partial', 'partialRight', 'partition', 'pick', 'pickBy', 'pull', 'pullAll',
|
||||||
'pullAt', 'random', 'range', 'rangeRight', 'rearg', 'reject', 'remove',
|
'pullAt', 'random', 'range', 'rangeRight', 'rearg', 'reject', 'remove',
|
||||||
'repeat', 'result', 'sampleSize', 'some', 'sortBy', 'sortedIndex',
|
'repeat', 'result', 'sampleSize', 'some', 'sortBy', 'sortedIndex',
|
||||||
'sortedIndexOf', 'sortedLastIndex', 'sortedLastIndexOf', 'sortedUniqBy',
|
'sortedIndexOf', 'sortedLastIndex', 'sortedLastIndexOf', 'sortedUniqBy',
|
||||||
'split', 'startsWith', 'subtract', 'sumBy', 'take', 'takeRight', 'takeRightWhile',
|
'split', 'startsWith', 'subtract', 'sumBy', 'take', 'takeRight', 'takeRightWhile',
|
||||||
'takeWhile', 'tap', 'throttle', 'thru', 'times', 'trimChars', 'trimCharsEnd',
|
'takeWhile', 'tap', 'throttle', 'thru', 'times', 'trimChars', 'trimCharsEnd',
|
||||||
'trimCharsStart', 'truncate', 'union', 'uniqBy', 'uniqWith', 'unset',
|
'trimCharsStart', 'truncate', 'union', 'uniqBy', 'uniqWith', 'unset',
|
||||||
'unzipWith', 'without', 'wrap', 'xor', 'zip', 'zipObject', 'zipObjectDeep'
|
'unzipWith', 'without', 'wrap', 'xor', 'zip', 'zipObject', 'zipObjectDeep'
|
||||||
],
|
],
|
||||||
3: [
|
'3': [
|
||||||
'assignInWith', 'assignWith', 'clamp', 'differenceBy', 'differenceWith',
|
'assignInWith', 'assignWith', 'clamp', 'differenceBy', 'differenceWith',
|
||||||
'getOr', 'inRange', 'intersectionBy', 'intersectionWith', 'isEqualWith',
|
'getOr', 'inRange', 'intersectionBy', 'intersectionWith', 'isEqualWith',
|
||||||
'isMatchWith', 'mergeWith', 'pullAllBy', 'reduce', 'reduceRight', 'replace',
|
'isMatchWith', 'mergeWith', 'pullAllBy', 'reduce', 'reduceRight', 'replace',
|
||||||
'set', 'slice', 'sortedIndexBy', 'sortedLastIndexBy', 'transform', 'unionBy',
|
'set', 'slice', 'sortedIndexBy', 'sortedLastIndexBy', 'transform', 'unionBy',
|
||||||
'unionWith', 'xorBy', 'xorWith', 'zipWith'
|
'unionWith', 'xorBy', 'xorWith', 'zipWith'
|
||||||
],
|
],
|
||||||
4: [
|
'4': [
|
||||||
'fill', 'setWith'
|
'fill', 'setWith'
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Used to map ary to rearg configs. */
|
/** Used to map ary to rearg configs. */
|
||||||
exports.aryRearg = {
|
exports.aryRearg = {
|
||||||
2: [1, 0],
|
'2': [1, 0],
|
||||||
3: [2, 0, 1],
|
'3': [2, 0, 1],
|
||||||
4: [3, 2, 0, 1]
|
'4': [3, 2, 0, 1]
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Used to iterate `mapping.aryMethod` keys. */
|
|
||||||
exports.caps = [1, 2, 3, 4];
|
|
||||||
|
|
||||||
/** Used to map method names to their iteratee ary. */
|
/** Used to map method names to their iteratee ary. */
|
||||||
exports.iterateeAry = {
|
exports.iterateeAry = {
|
||||||
'assignWith': 2,
|
'assignWith': 2,
|
||||||
|
|||||||
Reference in New Issue
Block a user