We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7f1bdc9 commit 9a21928Copy full SHA for 9a21928
lib/model.js
@@ -1,16 +1,21 @@
1
const models = {};
2
3
-function model(data) {
+function model(data, modelName) {
4
+ if(!data) {
5
+ return this;
6
+ }
7
+
8
// ToDo: Validate model
9
// ToDo: Check if model already exists to merge instead of set
-
- models[this.modelName] = data;
10
+ var name = this.modelName || modelName;
11
+ models[name] = data;
12
13
return this;
14
}
15
-function get() {
- return models[this.modelName] || {};
16
+function get(modelName) {
17
18
+ return models[name] || {};
19
20
21
0 commit comments