@ztimson/utils 0.25.13 → 0.25.15

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) {
@@ -1169,7 +1177,7 @@ ${opts.message || this.desc}`;
1169
1177
  }
1170
1178
  function timestampFilename(name, date = /* @__PURE__ */ new Date()) {
1171
1179
  if (typeof date == "number" || typeof date == "string") date = new Date(date);
1172
- const timestamp = formatDate("YYYY-MM-DD_HH:mm:ss", date);
1180
+ const timestamp = formatDate("YYYY-MM-DD_HH-mm", date);
1173
1181
  return name ? name.replace("{{TIMESTAMP}}", timestamp) : timestamp;
1174
1182
  }
1175
1183
  function uploadWithProgress(options) {