2020-04-10 15:08:41 +03:00
|
|
|
const glob = require('glob');
|
|
|
|
const path = require('path');
|
2014-02-05 02:01:53 +04:00
|
|
|
|
2020-04-10 15:08:41 +03:00
|
|
|
const helpers = {};
|
2015-05-13 12:26:49 +03:00
|
|
|
|
2020-04-10 15:08:41 +03:00
|
|
|
// We use glob here because it's already a dependency
|
|
|
|
// If we want to get rid of glob we could use E.g. requiredir
|
|
|
|
// Or require('fs').readdirSync(__dirname + '/')
|
|
|
|
let helperFiles = glob.sync('!(index).js', {cwd: __dirname});
|
|
|
|
helperFiles.forEach((helper) => {
|
|
|
|
let name = helper.replace(/.js$/, '');
|
|
|
|
helpers[name] = require(path.join(__dirname, helper));
|
|
|
|
});
|
|
|
|
|
|
|
|
module.exports = helpers;
|