lib/dependency.injector.js
function loadMappings(rootDir, paths) {
        var mappings = {}, i, j, fullPath, fileNames, fileName, path, name, val;

        if (!paths) {
            return mappings;
        }

        for (i = 0; i < paths.length; i++) {
            path = paths[i];
            fullPath = rootDir + '/' + path;

            // if the directory doesn't exist, then skip to the next loop iteration
            if (!fs.existsSync(p.normalize(fullPath))) {
                continue;
            }

            // loop through all files in this folder
            fileNames = fs.readdirSync(p.normalize(fullPath));

            for (j = 0; j < fileNames.length; j++) {
                fileName = fileNames[j];

                // if it is a javascript file and it DOES NOT end in .service.js, then save the mapping
                if (utils.isJavaScript(fileName) && !fileName.match(/^.*\.service\.js$/)) {
                    name = utils.getCamelCase(fileName);
                    val = utils.getModulePath(path, fileName);
                    mappings[name] = val;
                    mappings[name.substring(0, 1).toUpperCase() + name.substring(1)] = val;  // store PascalCase as well
                }

                // else if we are dealing with a directory, recurse down into the folder
                else if (fs.lstatSync(p.join(fullPath, fileName)).isDirectory()) {
                    _.extend(mappings, this.loadMappings(rootDir, [path + '/' + fileName]));
                }
            }
        }

        return mappings;
    }
function loadMappings(rootDir, paths) {
        var mappings = {}, i, j, fullPath, fileNames, fileName, path, name, val;

        if (!paths) {
            return mappings;
        }

        for (i = 0; i < paths.length; i++) {
            path = paths[i];
            fullPath = rootDir + '/' + path;

            // if the directory doesn't exist, then skip to the next loop iteration
            if (!fs.existsSync(p.normalize(fullPath))) {
                continue;
            }

            // loop through all files in this folder
            fileNames = fs.readdirSync(p.normalize(fullPath));

            for (j = 0; j < fileNames.length; j++) {
                fileName = fileNames[j];

                // if it is a javascript file and it DOES NOT end in .service.js, then save the mapping
                if (utils.isJavaScript(fileName) && !fileName.match(/^.*\.service\.js$/)) {
                    name = utils.getCamelCase(fileName);
                    val = utils.getModulePath(path, fileName);
                    mappings[name] = val;
                    mappings[name.substring(0, 1).toUpperCase() + name.substring(1)] = val;  // store PascalCase as well
                }

                // else if we are dealing with a directory, recurse down into the folder
                else if (fs.lstatSync(p.join(fullPath, fileName)).isDirectory()) {
                    _.extend(mappings, this.loadMappings(rootDir, [path + '/' + fileName]));
                }
            }
        }

        return mappings;
    }
function loadMappings ( rootDir , paths ) { var mappings = { } , i , j , fullPath , fileNames , fileName , path , name , val ; if ( ! paths ) { return mappings ; } for ( i = 0 ; i < paths . length ; i ++ ) { path = paths [ i ] ; fullPath = rootDir + '/' + path ; // if the directory doesn't exist, then skip to the next loop iteration if ( ! fs . existsSync ( p . normalize ( fullPath ) ) ) { continue ; } // loop through all files in this folder fileNames = fs . readdirSync ( p . normalize ( fullPath ) ) ; for ( j = 0 ; j < fileNames . length ; j ++ ) { fileName = fileNames [ j ] ; // if it is a javascript file and it DOES NOT end in .service.js, then save the mapping if ( utils . isJavaScript ( fileName ) && ! fileName . match ( / ^.*\.service\.js$ / ) ) { name = utils . getCamelCase ( fileName ) ; val = utils . getModulePath ( path , fileName ) ; mappings [ name ] = val ; mappings [ name . substring ( 0 , 1 ) . toUpperCase ( ) + name . substring ( 1 ) ] = val ; // store PascalCase as well } // else if we are dealing with a directory, recurse down into the folder else if ( fs . lstatSync ( p . join ( fullPath , fileName ) ) . isDirectory ( ) ) { _ . extend ( mappings , this . loadMappings ( rootDir , [ path + '/' + fileName ] ) ) ; } } } return mappings ; }
Based on a given directory, get the mappings of camelCase name for a given file
to the file's relative path from the app root.

@param rootDir
@param paths
@returns {{}} The mappings of param name to location
Based on a given directory get the mappings of camelCase name for a given file to the file s relative path from the app root .