19 lines
430 B
JavaScript
19 lines
430 B
JavaScript
|
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');
|