jsadvent/lib/index.js

19 lines
430 B
JavaScript
Raw Normal View History

2020-12-10 08:33:00 +00:00
const fs = require('fs');
const path = require('path');
module.exports = {};
for (const filename of fs.readdirSync(__dirname)) {
if (filename === 'index.js' || !filename.endsWith('.js')) {
continue;
}
const resolved = path.resolve(__dirname, filename);
if (!fs.statSync(resolved).isFile()) {
continue;
}
const key = filename.slice(0, -3);
module.exports[key] = require(resolved);
}
require('./_pollute');