mirror of
https://github.com/wassname/generator-react-webpack.git
synced 2026-09-09 11:22:44 +08:00
Added another utility #getDestinationClassName to get the final classname of a given path
This commit is contained in:
+15
-1
@@ -139,11 +139,25 @@ let getDestinationPath = (name, type, suffix) => {
|
||||
return `${fullPath}.js`;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the destinations class name
|
||||
* @param {String} name Name of the file
|
||||
* @param {String} type The type to use (e.g. action, store, ...)
|
||||
* @param {Suffix} suffix The suffix to use for the file (e.g. Store, Actions, ...)
|
||||
* @return {String} The javascript class name to use
|
||||
*/
|
||||
let getDestinationClassName = (name, type, suffix) => {
|
||||
|
||||
let fixedName = getDestinationPath(name, type, suffix);
|
||||
return _.capitalize(fixedName.split('/').pop().split('.js')[0]);
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
getBaseDir: getBaseDir,
|
||||
getAllSettingsFromComponentName: getAllSettingsFromComponentName,
|
||||
getAppName: getAppName,
|
||||
getCleanedPathName: getCleanedPathName,
|
||||
getComponentStyleName: getComponentStyleName,
|
||||
getDestinationPath: getDestinationPath
|
||||
getDestinationPath: getDestinationPath,
|
||||
getDestinationClassName: getDestinationClassName
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user