@shaxpir/duiduidui-models 1.4.22 → 1.4.23
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/dist/models/Model.js +8 -0
- package/package.json +1 -1
package/dist/models/Model.js
CHANGED
|
@@ -64,12 +64,20 @@ class Model {
|
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
66
|
get kind() {
|
|
67
|
+
// Defensive check in case doc isn't fully initialized
|
|
68
|
+
if (!this.doc || !this.doc.collection) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
67
71
|
return this.doc.collection;
|
|
68
72
|
}
|
|
69
73
|
get ref() {
|
|
70
74
|
return this.doc.id;
|
|
71
75
|
}
|
|
72
76
|
get compoundKey() {
|
|
77
|
+
// Defensive check in case doc isn't fully initialized
|
|
78
|
+
if (!this.doc || !this.doc.collection || !this.doc.id) {
|
|
79
|
+
return 'unknown/unknown';
|
|
80
|
+
}
|
|
73
81
|
return `${this.doc.collection}/${this.doc.id}`;
|
|
74
82
|
}
|
|
75
83
|
exists() {
|