@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.cjs CHANGED
@@ -547,7 +547,14 @@ ${opts.message || this.desc}`;
547
547
  if (options.storage instanceof Table) {
548
548
  (async () => {
549
549
  var _a2;
550
- return (await ((_a2 = options.storage) == null ? void 0 : _a2.getAll())).forEach((v) => this.add(v));
550
+ return (await ((_a2 = options.storage) == null ? void 0 : _a2.getAll())).forEach((v) => {
551
+ if (v) {
552
+ try {
553
+ this.add(v);
554
+ } catch {
555
+ }
556
+ }
557
+ });
551
558
  })();
552
559
  } else if (options.storageKey) {
553
560
  const stored = (_a = options.storage) == null ? void 0 : _a.getItem(options.storageKey);
@@ -571,6 +578,7 @@ ${opts.message || this.desc}`;
571
578
  }
572
579
  getKey(value) {
573
580
  if (!this.key) throw new Error("No key defined");
581
+ if (value[this.key] === void 0) throw new Error(`${this.key.toString()} Doesn't exist on ${JSON.stringify(value, null, 2)}`);
574
582
  return value[this.key];
575
583
  }
576
584
  save(key) {