123456789101112 |
- var fs = require('fs'),
- glob = require('glob'),
- path = require('path'),
- classes = {},
- dir = __dirname;
- glob.sync(dir + "/**/*.js", {ignore:[dir +"/index.js"]} ).forEach( function( file ) {
- var className = fs.readFileSync(file, "utf8").trim().split("\n")[0].split("class")[1].replace("{", "").trim();
- classes[className] = require(path.resolve(file));
- });
- module.exports = classes;
|