MCPcopy Index your code
hub / github.com/ember-cli/ember-cli / requireAsHash

Function requireAsHash

lib/utilities/require-as-hash.js:21–32  ·  view source on GitHub ↗
(pattern, type)

Source from the content-addressed store, hash-verified

19
20module.exports = requireAsHash;
21function 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}

Callers 3

loadCommandsFunction · 0.85
loadTasksFunction · 0.85
help-test.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…