mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 10:07:48 +00:00
Use mapping for aliasToReal.
This commit is contained in:
@@ -10,12 +10,6 @@ var mapping = require('../../fp/_mapping');
|
|||||||
|
|
||||||
var templatePath = path.join(__dirname, 'template');
|
var templatePath = path.join(__dirname, 'template');
|
||||||
|
|
||||||
var aliasToReal = _.transform(mapping.realToAlias, function(result, aliases, realName) {
|
|
||||||
_.each(aliases, function(alias) {
|
|
||||||
result[alias] = realName;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
var template = _.transform(glob.sync(path.join(templatePath, '*.jst')), function(result, filePath) {
|
var template = _.transform(glob.sync(path.join(templatePath, '*.jst')), function(result, filePath) {
|
||||||
result[path.basename(filePath, '.jst')] = _.template(fs.readFileSync(filePath));
|
result[path.basename(filePath, '.jst')] = _.template(fs.readFileSync(filePath));
|
||||||
}, {});
|
}, {});
|
||||||
@@ -42,7 +36,7 @@ var categories = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
function isAlias(funcName) {
|
function isAlias(funcName) {
|
||||||
return _.has(aliasToReal, funcName);
|
return _.has(mapping.aliasToReal, funcName);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isCategory(funcName) {
|
function isCategory(funcName) {
|
||||||
@@ -56,7 +50,7 @@ function isThru(funcName) {
|
|||||||
function getTemplate(moduleName) {
|
function getTemplate(moduleName) {
|
||||||
var data = {
|
var data = {
|
||||||
'key': mapping.key,
|
'key': mapping.key,
|
||||||
'name': _.result(aliasToReal, moduleName, moduleName)
|
'name': _.result(mapping.aliasToReal, moduleName, moduleName)
|
||||||
};
|
};
|
||||||
|
|
||||||
if (isAlias(moduleName)) {
|
if (isAlias(moduleName)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user