mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Remove mapping shortcut references.
This commit is contained in:
@@ -1,7 +1,4 @@
|
||||
var mapping = require('./_mapping'),
|
||||
aliasToReal = mapping.aliasToReal,
|
||||
mutateMap = mapping.mutate,
|
||||
remap = mapping.remap,
|
||||
fallbackHolder = require('./placeholder');
|
||||
|
||||
/**
|
||||
@@ -353,8 +350,8 @@ function baseConvert(util, name, func, options) {
|
||||
* @returns {Function} Returns the new converter function.
|
||||
*/
|
||||
function createConverter(name, func) {
|
||||
var realName = aliasToReal[name] || name,
|
||||
methodName = remap[realName] || realName,
|
||||
var realName = mapping.aliasToReal[name] || name,
|
||||
methodName = mapping.remap[realName] || realName,
|
||||
oldOptions = options;
|
||||
|
||||
return function(options) {
|
||||
@@ -433,38 +430,37 @@ function baseConvert(util, name, func, options) {
|
||||
* @returns {Function} Returns the converted function.
|
||||
*/
|
||||
function wrap(name, func) {
|
||||
name = aliasToReal[name] || name;
|
||||
|
||||
var result,
|
||||
realName = mapping.aliasToReal[name] || name,
|
||||
wrapped = func,
|
||||
wrapper = wrappers[name];
|
||||
wrapper = wrappers[realName];
|
||||
|
||||
if (wrapper) {
|
||||
wrapped = wrapper(func);
|
||||
}
|
||||
else if (config.immutable) {
|
||||
if (mutateMap.array[name]) {
|
||||
if (mapping.mutate.array[realName]) {
|
||||
wrapped = wrapImmutable(func, cloneArray);
|
||||
}
|
||||
else if (mutateMap.object[name]) {
|
||||
else if (mapping.mutate.object[realName]) {
|
||||
wrapped = wrapImmutable(func, createCloner(func));
|
||||
}
|
||||
else if (mutateMap.set[name]) {
|
||||
else if (mapping.mutate.set[realName]) {
|
||||
wrapped = wrapImmutable(func, cloneByPath);
|
||||
}
|
||||
}
|
||||
each(aryMethodKeys, function(aryKey) {
|
||||
each(mapping.aryMethod[aryKey], function(otherName) {
|
||||
if (name == otherName) {
|
||||
var spreadData = mapping.methodSpread[name],
|
||||
if (realName == otherName) {
|
||||
var spreadData = mapping.methodSpread[realName],
|
||||
afterRearg = spreadData && spreadData.afterRearg;
|
||||
|
||||
result = afterRearg
|
||||
? castFixed(name, castRearg(name, wrapped, aryKey), aryKey)
|
||||
: castRearg(name, castFixed(name, wrapped, aryKey), aryKey);
|
||||
? castFixed(realName, castRearg(realName, wrapped, aryKey), aryKey)
|
||||
: castRearg(realName, castFixed(realName, wrapped, aryKey), aryKey);
|
||||
|
||||
result = castCap(name, result);
|
||||
result = castCurry(name, result, aryKey);
|
||||
result = castCap(realName, result);
|
||||
result = castCurry(realName, result, aryKey);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
@@ -477,8 +473,8 @@ function baseConvert(util, name, func, options) {
|
||||
return func.apply(this, arguments);
|
||||
};
|
||||
}
|
||||
result.convert = createConverter(name, func);
|
||||
if (mapping.placeholder[name]) {
|
||||
result.convert = createConverter(realName, func);
|
||||
if (mapping.placeholder[realName]) {
|
||||
setPlaceholder = true;
|
||||
result.placeholder = func.placeholder = placeholder;
|
||||
}
|
||||
@@ -496,7 +492,7 @@ function baseConvert(util, name, func, options) {
|
||||
var pairs = [];
|
||||
each(aryMethodKeys, function(aryKey) {
|
||||
each(mapping.aryMethod[aryKey], function(key) {
|
||||
var func = _[remap[key] || key];
|
||||
var func = _[mapping.remap[key] || key];
|
||||
if (func) {
|
||||
pairs.push([key, wrap(key, func)]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user