1 | "use strict";
|
2 | const CustomError = require("./Error");
|
3 | const Model_1 = require("./Model");
|
4 | let models = {};
|
5 | const returnObject = (input) => {
|
6 | if (input instanceof Model_1.Model) {
|
7 | models[input.name] = input;
|
8 | return input;
|
9 | }
|
10 | else if (typeof input === "string") {
|
11 | return models[input];
|
12 | }
|
13 | else {
|
14 | throw new CustomError.InvalidParameter("You must pass in a Model or table name as a string.");
|
15 | }
|
16 | };
|
17 | returnObject.clear = () => {
|
18 | models = {};
|
19 | };
|
20 | module.exports = returnObject;
|
21 |
|
\ | No newline at end of file |