MCPcopy Index your code
hub / github.com/Vincit/objection.js / requireUsingModelPaths

Function requireUsingModelPaths

lib/utils/resolveModel.js:38–56  ·  view source on GitHub ↗
(modelRef, modelPaths)

Source from the content-addressed store, hash-verified

36}
37
38function requireUsingModelPaths(modelRef, modelPaths) {
39 let firstError = null;
40
41 for (const modelPath of modelPaths) {
42 try {
43 return requireModel(path.join(modelPath, modelRef));
44 } catch (err) {
45 if (firstError === null) {
46 firstError = err;
47 }
48 }
49 }
50
51 if (firstError) {
52 throw firstError;
53 } else {
54 throw new ResolveError(`could not resolve ${modelRef} using modelPaths`);
55 }
56}
57
58function requireModel(modelPath) {
59 /**

Callers 1

resolveModelFunction · 0.85

Calls 2

requireModelFunction · 0.85
joinMethod · 0.45

Tested by

no test coverage detected