mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 10:27:49 +00:00
Add aliasToReal fp mapping.
This commit is contained in:
@@ -1,3 +1,37 @@
|
|||||||
|
/** Used to map aliases to their real names. */
|
||||||
|
exports.aliasToReal = {
|
||||||
|
'all': 'some',
|
||||||
|
'allPass': 'overEvery',
|
||||||
|
'apply': 'spread',
|
||||||
|
'compose': 'flowRight',
|
||||||
|
'contains': 'includes',
|
||||||
|
'dissoc': 'omit',
|
||||||
|
'each': 'forEach',
|
||||||
|
'eachRight': 'forEachRight',
|
||||||
|
'equals': 'isEqual',
|
||||||
|
'extend': 'assignIn',
|
||||||
|
'extendWith': 'assignInWith',
|
||||||
|
'first': 'head',
|
||||||
|
'init': 'initial',
|
||||||
|
'mapObj': 'mapValues',
|
||||||
|
'omitAll': 'omit',
|
||||||
|
'nAry': 'ary',
|
||||||
|
'path': 'get',
|
||||||
|
'pathEq': 'matchesProperty',
|
||||||
|
'pathOr': 'getOr',
|
||||||
|
'pickAll': 'pick',
|
||||||
|
'pipe': 'flow',
|
||||||
|
'prop': 'get',
|
||||||
|
'propOf': 'propertyOf',
|
||||||
|
'propOr': 'getOr',
|
||||||
|
'somePass': 'overSome',
|
||||||
|
'unapply': 'rest',
|
||||||
|
'unnest': 'flatten',
|
||||||
|
'useWith': 'overArgs',
|
||||||
|
'whereEq': 'filter',
|
||||||
|
'zipObj': 'zipObject'
|
||||||
|
};
|
||||||
|
|
||||||
/** Used to map method names to their iteratee ary. */
|
/** Used to map method names to their iteratee ary. */
|
||||||
exports.aryIteratee = {
|
exports.aryIteratee = {
|
||||||
'assignWith': 2,
|
'assignWith': 2,
|
||||||
@@ -154,35 +188,21 @@ exports.placeholder = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** Used to map real names to their aliases. */
|
/** Used to map real names to their aliases. */
|
||||||
exports.realToAlias = {
|
exports.realToAlias = (function() {
|
||||||
'ary': ['nAry'],
|
var hasOwnProperty = Object.prototype.hasOwnProperty,
|
||||||
'assignIn': ['extend'],
|
object = exports.aliasToReal,
|
||||||
'assignInWith': ['extendWith'],
|
result = {};
|
||||||
'filter': ['whereEq'],
|
|
||||||
'flatten': ['unnest'],
|
for (var key in object) {
|
||||||
'flow': ['pipe'],
|
var value = object[key];
|
||||||
'flowRight': ['compose'],
|
if (hasOwnProperty.call(result, value)) {
|
||||||
'forEach': ['each'],
|
result[value].push(key);
|
||||||
'forEachRight': ['eachRight'],
|
} else {
|
||||||
'get': ['path', 'prop'],
|
result[value] = [key];
|
||||||
'getOr': ['pathOr', 'propOr'],
|
}
|
||||||
'head': ['first'],
|
}
|
||||||
'includes': ['contains'],
|
return result;
|
||||||
'initial': ['init'],
|
}());
|
||||||
'isEqual': ['equals'],
|
|
||||||
'mapValues': ['mapObj'],
|
|
||||||
'matchesProperty': ['pathEq'],
|
|
||||||
'omit': ['dissoc', 'omitAll'],
|
|
||||||
'overArgs': ['useWith'],
|
|
||||||
'overEvery': ['allPass'],
|
|
||||||
'overSome': ['somePass'],
|
|
||||||
'pick': ['pickAll'],
|
|
||||||
'propertyOf': ['propOf'],
|
|
||||||
'rest': ['unapply'],
|
|
||||||
'some': ['all'],
|
|
||||||
'spread': ['apply'],
|
|
||||||
'zipObject': ['zipObj']
|
|
||||||
};
|
|
||||||
|
|
||||||
/** Used to track methods that skip `_.rearg`. */
|
/** Used to track methods that skip `_.rearg`. */
|
||||||
exports.skipRearg = {
|
exports.skipRearg = {
|
||||||
|
|||||||
Reference in New Issue
Block a user