@ztimson/utils 0.25.13 → 0.25.14

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.mjs CHANGED
@@ -543,7 +543,14 @@ class Cache {
543
543
  if (options.storage instanceof Table) {
544
544
  (async () => {
545
545
  var _a2;
546
- return (await ((_a2 = options.storage) == null ? void 0 : _a2.getAll())).forEach((v) => this.add(v));
546
+ return (await ((_a2 = options.storage) == null ? void 0 : _a2.getAll())).forEach((v) => {
547
+ if (v) {
548
+ try {
549
+ this.add(v);
550
+ } catch {
551
+ }
552
+ }
553
+ });
547
554
  })();
548
555
  } else if (options.storageKey) {
549
556
  const stored = (_a = options.storage) == null ? void 0 : _a.getItem(options.storageKey);
@@ -567,6 +574,7 @@ class Cache {
567
574
  }
568
575
  getKey(value) {
569
576
  if (!this.key) throw new Error("No key defined");
577
+ if (value[this.key] === void 0) throw new Error(`${this.key.toString()} Doesn't exist on ${JSON.stringify(value, null, 2)}`);
570
578
  return value[this.key];
571
579
  }
572
580
  save(key) {