@itrocks/lazy-loading 0.0.5 → 0.0.6
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/cjs/lazy-loading.js +9 -3
- package/esm/lazy-loading.js +9 -3
- package/package.json +1 -1
package/cjs/lazy-loading.js
CHANGED
|
@@ -23,7 +23,7 @@ function defineCollectionProperty(type, property, builtClass) {
|
|
|
23
23
|
set(value) {
|
|
24
24
|
delete this[property + '_ids'];
|
|
25
25
|
Object.defineProperty(this, property, { configurable: true, enumerable: true, value, writable: true });
|
|
26
|
-
Reflect.
|
|
26
|
+
Reflect.defineMetadata(exports.PROTECT_GET, false, this, property);
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
Object.defineProperty(builtClass.prototype, property, descriptor);
|
|
@@ -41,7 +41,7 @@ function defineObjectProperty(type, property, builtClass) {
|
|
|
41
41
|
set(value) {
|
|
42
42
|
delete this[property + '_id'];
|
|
43
43
|
Object.defineProperty(this, property, { configurable: true, enumerable: true, value, writable: true });
|
|
44
|
-
Reflect.
|
|
44
|
+
Reflect.defineMetadata(exports.PROTECT_GET, false, this, property);
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
47
|
Object.defineProperty(builtClass.prototype, property, descriptor);
|
|
@@ -62,7 +62,13 @@ function initClass(classType) {
|
|
|
62
62
|
constructor(...args) {
|
|
63
63
|
super(...args);
|
|
64
64
|
for (const property of properties) {
|
|
65
|
-
|
|
65
|
+
const value = Object.getOwnPropertyDescriptor(this, property)?.value;
|
|
66
|
+
if ((value === undefined) || (Array.isArray(value) && !value.length)) {
|
|
67
|
+
delete this[property];
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
Reflect.defineMetadata(exports.PROTECT_GET, false, this, property);
|
|
71
|
+
}
|
|
66
72
|
}
|
|
67
73
|
}
|
|
68
74
|
})();
|
package/esm/lazy-loading.js
CHANGED
|
@@ -20,7 +20,7 @@ function defineCollectionProperty(type, property, builtClass) {
|
|
|
20
20
|
set(value) {
|
|
21
21
|
delete this[property + '_ids'];
|
|
22
22
|
Object.defineProperty(this, property, { configurable: true, enumerable: true, value, writable: true });
|
|
23
|
-
Reflect.
|
|
23
|
+
Reflect.defineMetadata(PROTECT_GET, false, this, property);
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
26
|
Object.defineProperty(builtClass.prototype, property, descriptor);
|
|
@@ -38,7 +38,7 @@ function defineObjectProperty(type, property, builtClass) {
|
|
|
38
38
|
set(value) {
|
|
39
39
|
delete this[property + '_id'];
|
|
40
40
|
Object.defineProperty(this, property, { configurable: true, enumerable: true, value, writable: true });
|
|
41
|
-
Reflect.
|
|
41
|
+
Reflect.defineMetadata(PROTECT_GET, false, this, property);
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
Object.defineProperty(builtClass.prototype, property, descriptor);
|
|
@@ -59,7 +59,13 @@ export function initClass(classType) {
|
|
|
59
59
|
constructor(...args) {
|
|
60
60
|
super(...args);
|
|
61
61
|
for (const property of properties) {
|
|
62
|
-
|
|
62
|
+
const value = Object.getOwnPropertyDescriptor(this, property)?.value;
|
|
63
|
+
if ((value === undefined) || (Array.isArray(value) && !value.length)) {
|
|
64
|
+
delete this[property];
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
Reflect.defineMetadata(PROTECT_GET, false, this, property);
|
|
68
|
+
}
|
|
63
69
|
}
|
|
64
70
|
}
|
|
65
71
|
})();
|
package/package.json
CHANGED