miolo-model 3.0.0-beta.176 → 3.0.0-beta.178
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/MioloModel.mjs +12 -0
package/package.json
CHANGED
package/src/MioloModel.mjs
CHANGED
|
@@ -27,6 +27,9 @@ export default class MioloModel extends CacheMixin() {
|
|
|
27
27
|
get_extra_data() {
|
|
28
28
|
const data = {}
|
|
29
29
|
for (const [key, value] of Object.entries(this)) {
|
|
30
|
+
if (key.startsWith("__")) {
|
|
31
|
+
continue
|
|
32
|
+
}
|
|
30
33
|
if (value instanceof MioloModel || value instanceof MioloArray) {
|
|
31
34
|
data[key] = value.get_data()
|
|
32
35
|
} else if (Array.isArray(value) && value.every((v) => v instanceof MioloModel)) {
|
|
@@ -39,6 +42,9 @@ export default class MioloModel extends CacheMixin() {
|
|
|
39
42
|
getExtraData() {
|
|
40
43
|
const data = {}
|
|
41
44
|
for (const [key, value] of Object.entries(this)) {
|
|
45
|
+
if (key.startsWith("__")) {
|
|
46
|
+
continue
|
|
47
|
+
}
|
|
42
48
|
if (value instanceof MioloModel || value instanceof MioloArray) {
|
|
43
49
|
data[key] = value.getData()
|
|
44
50
|
} else if (Array.isArray(value) && value.every((v) => v instanceof MioloModel)) {
|
|
@@ -76,6 +82,9 @@ export default class MioloModel extends CacheMixin() {
|
|
|
76
82
|
}
|
|
77
83
|
|
|
78
84
|
for (const [key, value] of Object.entries(this)) {
|
|
85
|
+
if (key.startsWith("__")) {
|
|
86
|
+
continue
|
|
87
|
+
}
|
|
79
88
|
if (value instanceof MioloModel) {
|
|
80
89
|
if (changes[key] !== undefined) {
|
|
81
90
|
value.update(changes[key])
|
|
@@ -87,6 +96,9 @@ export default class MioloModel extends CacheMixin() {
|
|
|
87
96
|
merge(model) {
|
|
88
97
|
this.update(model.getData())
|
|
89
98
|
for (const [key, value] of Object.entries(model)) {
|
|
99
|
+
if (key.startsWith("__")) {
|
|
100
|
+
continue
|
|
101
|
+
}
|
|
90
102
|
if (value instanceof MioloModel || value instanceof MioloArray) {
|
|
91
103
|
this[key] = value
|
|
92
104
|
} else if (Array.isArray(value) && value.every((v) => v instanceof MioloModel)) {
|