https://github.com/angular/angular
Raw File
Tip revision: adaa157317da4305e659c41e44f664023aacc12d authored by yjbanov on 19 May 2015, 21:47:59 UTC
chore(packaging): bump version to 2.0.0-alpha.24
Tip revision: adaa157
file2modulename.js
function file2moduleName(filePath) {
  return filePath.replace(/\\/g, '/')
    // module name should be relative to `modules` and `tools` folder
    .replace(/.*\/modules\//, '')
    .replace(/.*\/tools\//, '')
    //  and 'dist' folder
    .replace(/.*\/dist\/js\/dev\/es5\//, '')
    // module name should not include `lib`, `web` folders
    // as they are wrapper packages for dart
    .replace(/\/web\//, '/')
    .replace(/\/lib\//, '/')
    // module name should not have a suffix
    .replace(/\.\w*$/, '');
}
if (typeof module !== 'undefined') {
  module.exports = file2moduleName;
}
back to top