lib/moduleLoader/lib/requireAll.js
function (options, iterationInfo, modules) {

        // Ignore explicitly excluded directories
        if (options.excludeDirs) {
            var match = iterationInfo.fileName.match(options.excludeDirs);
            if (match)
                return;
        }

        // Recursively call requireAll on each child directory
        var subIterationInfo = _.clone(iterationInfo);
        ++subIterationInfo.depth;
        subIterationInfo.dirName = iterationInfo.absoluteFullPath;

        //process subtree recursively
        var subTreeResult = doInterations(options, subIterationInfo);

        //omit empty dirs
        if (_.isEmpty(subTreeResult))
            return;

        //add to the list or to the subtree
        if (options.mode === 'list') {
            //check uniqueness
            _.forEach(subTreeResult, function (value, index) {
                if (options.useVersions === true) {
                    modules[index] = modules[index] || {};
                    _.forEach(value, function (versionValue, versionIndex) {
                        if (modules[index][versionIndex])
                            throw new Error("Identity '" + index + "' with version '" + versionIndex + "' is already registered by module at '" + modules[index][versionIndex].absoluteFullPath + "'");
                        modules[index][versionIndex] = versionValue;
                    });
                }
                else {
                    if (modules[index])
                        throw new Error("Identity '" + index + "' is already registered by module at '" + modules[index].absoluteFullPath + "'");
                    modules[index] = value;
                }
            })
        }
        else if (options.mode === 'tree') {
            if (options.markDirectories !== false) {
                subTreeResult.isDirectory = true;
            }

            var identity = generateIdentity(options, iterationInfo);
            modules[identity] = subTreeResult;
        }
        else
            throw new Error('Unknown mode');
    }
function (options, iterationInfo, modules) {

        // Ignore explicitly excluded directories
        if (options.excludeDirs) {
            var match = iterationInfo.fileName.match(options.excludeDirs);
            if (match)
                return;
        }

        // Recursively call requireAll on each child directory
        var subIterationInfo = _.clone(iterationInfo);
        ++subIterationInfo.depth;
        subIterationInfo.dirName = iterationInfo.absoluteFullPath;

        //process subtree recursively
        var subTreeResult = doInterations(options, subIterationInfo);

        //omit empty dirs
        if (_.isEmpty(subTreeResult))
            return;

        //add to the list or to the subtree
        if (options.mode === 'list') {
            //check uniqueness
            _.forEach(subTreeResult, function (value, index) {
                if (options.useVersions === true) {
                    modules[index] = modules[index] || {};
                    _.forEach(value, function (versionValue, versionIndex) {
                        if (modules[index][versionIndex])
                            throw new Error("Identity '" + index + "' with version '" + versionIndex + "' is already registered by module at '" + modules[index][versionIndex].absoluteFullPath + "'");
                        modules[index][versionIndex] = versionValue;
                    });
                }
                else {
                    if (modules[index])
                        throw new Error("Identity '" + index + "' is already registered by module at '" + modules[index].absoluteFullPath + "'");
                    modules[index] = value;
                }
            })
        }
        else if (options.mode === 'tree') {
            if (options.markDirectories !== false) {
                subTreeResult.isDirectory = true;
            }

            var identity = generateIdentity(options, iterationInfo);
            modules[identity] = subTreeResult;
        }
        else
            throw new Error('Unknown mode');
    }
function ( options , iterationInfo , modules ) { // Ignore explicitly excluded directories if ( options . excludeDirs ) { var match = iterationInfo . fileName . match ( options . excludeDirs ) ; if ( match ) return ; } // Recursively call requireAll on each child directory var subIterationInfo = _ . clone ( iterationInfo ) ; ++ subIterationInfo . depth ; subIterationInfo . dirName = iterationInfo . absoluteFullPath ; //process subtree recursively var subTreeResult = doInterations ( options , subIterationInfo ) ; //omit empty dirs if ( _ . isEmpty ( subTreeResult ) ) return ; //add to the list or to the subtree if ( options . mode === 'list' ) { //check uniqueness _ . forEach ( subTreeResult , function ( value , index ) { if ( options . useVersions === true ) { modules [ index ] = modules [ index ] || { } ; _ . forEach ( value , function ( versionValue , versionIndex ) { if ( modules [ index ] [ versionIndex ] ) throw new Error ( "Identity '" + index + "' with version '" + versionIndex + "' is already registered by module at '" + modules [ index ] [ versionIndex ] . absoluteFullPath + "'" ) ; modules [ index ] [ versionIndex ] = versionValue ; } ) ; } else { if ( modules [ index ] ) throw new Error ( "Identity '" + index + "' is already registered by module at '" + modules [ index ] . absoluteFullPath + "'" ) ; modules [ index ] = value ; } } ) } else if ( options . mode === 'tree' ) { if ( options . markDirectories !== false ) { subTreeResult . isDirectory = true ; } var identity = generateIdentity ( options , iterationInfo ) ; modules [ identity ] = subTreeResult ; } else throw new Error ( 'Unknown mode' ) ; }
Processes one directory level
@param options :: general options
@param iterationInfo :: iteration options
@param modules :: object in which output will be loaded
Processes one directory level