lib/angoose.js
function scanDir(dirname){
        if(!dirname ||   dirname.indexOf("node_modules")>=0) return;
        logger.debug("Scanning directory for modules: ", dirname);
        if(fs.existsSync(path.resolve(dirname, 'index.js'))){
            files.push(path.resolve(dirname, 'index.js') );
            return;
        }
        fs.readdirSync( dirname  ).forEach(function(file) {
            var fullpath = path.resolve(dirname,file);
            if(! fs.statSync(fullpath).isFile()) scanDir( fullpath );
            else if (file.match(/.+\.js/g) !== null) {
                files.push(fullpath);
            }
        });
    }
function scanDir(dirname){
        if(!dirname ||   dirname.indexOf("node_modules")>=0) return;
        logger.debug("Scanning directory for modules: ", dirname);
        if(fs.existsSync(path.resolve(dirname, 'index.js'))){
            files.push(path.resolve(dirname, 'index.js') );
            return;
        }
        fs.readdirSync( dirname  ).forEach(function(file) {
            var fullpath = path.resolve(dirname,file);
            if(! fs.statSync(fullpath).isFile()) scanDir( fullpath );
            else if (file.match(/.+\.js/g) !== null) {
                files.push(fullpath);
            }
        });
    }
sample model