1 | const Error = require("./Error");
|
2 | let models = {};
|
3 |
|
4 | module.exports = (input) => {
|
5 | const Model = require("./Model");
|
6 | if (input instanceof Model) {
|
7 | models[input.name] = input;
|
8 | } else if (typeof input === "string") {
|
9 | return models[input];
|
10 | } else {
|
11 | throw new Error.InvalidParameter("You must pass in a Model or table name as a string.");
|
12 | }
|
13 | };
|
14 | module.exports.clear = () => {
|
15 | models = {};
|
16 | };
|