@ztimson/utils 0.23.12 → 0.23.13
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/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +5 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -421,11 +421,11 @@ ${opts.message || this.desc}`;
|
|
|
421
421
|
return new Proxy(this, {
|
|
422
422
|
get: (target, prop2) => {
|
|
423
423
|
if (prop2 in target) return target[prop2];
|
|
424
|
-
return target.store[prop2];
|
|
424
|
+
return deepCopy(target.store[prop2]);
|
|
425
425
|
},
|
|
426
426
|
set: (target, prop2, value2) => {
|
|
427
427
|
if (prop2 in target) target[prop2] = value2;
|
|
428
|
-
else
|
|
428
|
+
else this.set(prop2, value2);
|
|
429
429
|
return true;
|
|
430
430
|
}
|
|
431
431
|
});
|
|
@@ -440,7 +440,7 @@ ${opts.message || this.desc}`;
|
|
|
440
440
|
* @return {T[]} Array of items
|
|
441
441
|
*/
|
|
442
442
|
all() {
|
|
443
|
-
return Object.values(this.store);
|
|
443
|
+
return deepCopy(Object.values(this.store));
|
|
444
444
|
}
|
|
445
445
|
/**
|
|
446
446
|
* Add a new item to the cache. Like set, but finds key automatically
|
|
@@ -495,7 +495,7 @@ ${opts.message || this.desc}`;
|
|
|
495
495
|
* @return {T} Cached item
|
|
496
496
|
*/
|
|
497
497
|
get(key) {
|
|
498
|
-
return this.store[key];
|
|
498
|
+
return deepCopy(this.store[key]);
|
|
499
499
|
}
|
|
500
500
|
/**
|
|
501
501
|
* Get a list of cached keys
|
|
@@ -511,7 +511,7 @@ ${opts.message || this.desc}`;
|
|
|
511
511
|
* @return {Record<K, T>}
|
|
512
512
|
*/
|
|
513
513
|
map() {
|
|
514
|
-
return
|
|
514
|
+
return deepCopy(this.store);
|
|
515
515
|
}
|
|
516
516
|
/**
|
|
517
517
|
* Add an item to the cache manually specifying the key
|