buddy

node MVC discord bot
Log | Files | Refs | README

loader.js (286B)


      1 exports.require = function loader(list) {
      2   const errorLog = [];
      3   for (const [name, fn] of list) {
      4     try {
      5       const data = fn(require(name));
      6       data.name = name;
      7       return data;
      8     } catch (e) {
      9       errorLog.push(e);
     10     }
     11   }
     12   throw new Error(errorLog.join('\n'));
     13 };