(pattern, type)
| 19 | |
| 20 | module.exports = requireAsHash; |
| 21 | function requireAsHash(pattern, type) { |
| 22 | let callerFileDir = path.dirname(getCallerFile()); |
| 23 | return globSync(pattern, { cwd: callerFileDir }) |
| 24 | .sort() |
| 25 | .reduce((hash, file) => { |
| 26 | const klass = require(`${callerFileDir}/${file}`); |
| 27 | if (!type || klass.prototype instanceof type) { |
| 28 | hash[stringUtils.classify(path.basename(file, '.js'))] = klass; |
| 29 | } |
| 30 | return hash; |
| 31 | }, {}); |
| 32 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…