lib/ModuleFinder.js
function mapAllNames(path) {
    log("[%s] Mapping %s", self.parentModuleName, path);
    fs.readdirSync(path).forEach(function(p){
      var absPath = PATH.resolve(path+PATH.sep+p);
      var lstat = fs.lstatSync(absPath);

      if(lstat.isFile() && isModule(p)) {
        var name = getModuleName(p);
        self.updateNameCache(name, absPath);
      } else if(! isIgnoreFolder(p) && lstat.isDirectory()) {
        mapAllNames(absPath);
      }
    });

    function isIgnoreFolder(folderName) {
      return !folderName || folderName === 'node_modules' || folderName[0] === '.';
    }

    function isModule(p) {
      return p.match(/\.(js|json)$/);
    }

    function getModuleName(p) {
      return p.replace(/\.(js|json)$/, '');
    }
  }
function mapAllNames(path) {
    log("[%s] Mapping %s", self.parentModuleName, path);
    fs.readdirSync(path).forEach(function(p){
      var absPath = PATH.resolve(path+PATH.sep+p);
      var lstat = fs.lstatSync(absPath);

      if(lstat.isFile() && isModule(p)) {
        var name = getModuleName(p);
        self.updateNameCache(name, absPath);
      } else if(! isIgnoreFolder(p) && lstat.isDirectory()) {
        mapAllNames(absPath);
      }
    });

    function isIgnoreFolder(folderName) {
      return !folderName || folderName === 'node_modules' || folderName[0] === '.';
    }

    function isModule(p) {
      return p.match(/\.(js|json)$/);
    }

    function getModuleName(p) {
      return p.replace(/\.(js|json)$/, '');
    }
  }
function mapAllNames ( path ) { log ( "[%s] Mapping %s" , self . parentModuleName , path ) ; fs . readdirSync ( path ) . forEach ( function ( p ) { var absPath = PATH . resolve ( path + PATH . sep + p ) ; var lstat = fs . lstatSync ( absPath ) ; if ( lstat . isFile ( ) && isModule ( p ) ) { var name = getModuleName ( p ) ; self . updateNameCache ( name , absPath ) ; } else if ( ! isIgnoreFolder ( p ) && lstat . isDirectory ( ) ) { mapAllNames ( absPath ) ; } } ) ; function isIgnoreFolder ( folderName ) { return ! folderName || folderName === 'node_modules' || folderName [ 0 ] === '.' ; } function isModule ( p ) { return p . match ( / \.(js|json)$ / ) ; } function getModuleName ( p ) { return p . replace ( / \.(js|json)$ / , '' ) ; } }
Saves absPath -> filename mapping in the map
@param path
Saves absPath - > filename mapping in the map