mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 00:57:48 +00:00
Simplify fp map.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
var mapping = require('./mapping.js'),
|
||||
mutateMap = mapping.mutateMap;
|
||||
mutateMap = mapping.mutate;
|
||||
|
||||
/**
|
||||
* The base implementation of `convert` which accepts a `util` object of methods
|
||||
@@ -158,13 +158,13 @@ function baseConvert(util, name, func) {
|
||||
}
|
||||
var result;
|
||||
each(mapping.caps, function(cap) {
|
||||
each(mapping.aryMethodMap[cap], function(otherName) {
|
||||
each(mapping.aryMethod[cap], function(otherName) {
|
||||
if (name == otherName) {
|
||||
result = ary(func, cap);
|
||||
if (cap > 1 && !mapping.skipReargMap[name]) {
|
||||
result = rearg(result, mapping.methodReargMap[name] || mapping.aryReargMap[cap]);
|
||||
if (cap > 1 && !mapping.skipRearg[name]) {
|
||||
result = rearg(result, mapping.methodRearg[name] || mapping.aryRearg[cap]);
|
||||
}
|
||||
var n = !isLib && mapping.aryIterateeMap[name];
|
||||
var n = !isLib && mapping.aryIteratee[name];
|
||||
if (n) {
|
||||
result = iterateeAry(result, n);
|
||||
}
|
||||
@@ -185,8 +185,8 @@ function baseConvert(util, name, func) {
|
||||
// Iterate over methods for the current ary cap.
|
||||
var pairs = [];
|
||||
each(mapping.caps, function(cap) {
|
||||
each(mapping.aryMethodMap[cap], function(key) {
|
||||
var func = _[mapping.keyMap[key] || key];
|
||||
each(mapping.aryMethod[cap], function(key) {
|
||||
var func = _[mapping.key[key] || key];
|
||||
if (func) {
|
||||
pairs.push([key, wrap(key, func)]);
|
||||
}
|
||||
@@ -200,7 +200,7 @@ function baseConvert(util, name, func) {
|
||||
|
||||
// Wrap the lodash method and its aliases.
|
||||
each(keys(_), function(key) {
|
||||
each(mapping.aliasMap[key] || [], function(alias) {
|
||||
each(mapping.alias[key] || [], function(alias) {
|
||||
_[alias] = _[key];
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user