2014-09-28 16:55:01 -04:00
|
|
|
function file2moduleName(filePath) {
|
|
|
|
return filePath
|
|
|
|
// module name should be relative to `modules` and `tools` folder
|
|
|
|
.replace(/.*\/modules\//, '')
|
|
|
|
.replace(/.*\/tools\//, '')
|
|
|
|
// module name should not include `src`, `test`, `lib`
|
|
|
|
.replace(/\/src\//, '/')
|
|
|
|
.replace(/\/lib\//, '/')
|
|
|
|
// module name should not have a suffix
|
|
|
|
.replace(/\.\w*$/, '');
|
|
|
|
}
|
|
|
|
if (typeof module !== 'undefined') {
|
|
|
|
module.exports = file2moduleName;
|
2014-10-06 20:35:00 -04:00
|
|
|
}
|