@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.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) {
@@ -1165,7 +1173,7 @@ function fileText(file) {
1165
1173
  }
1166
1174
  function timestampFilename(name, date = /* @__PURE__ */ new Date()) {
1167
1175
  if (typeof date == "number" || typeof date == "string") date = new Date(date);
1168
- const timestamp = formatDate("YYYY-MM-DD_HH:mm:ss", date);
1176
+ const timestamp = formatDate("YYYY-MM-DD_HH-mm", date);
1169
1177
  return name ? name.replace("{{TIMESTAMP}}", timestamp) : timestamp;
1170
1178
  }
1171
1179
  function uploadWithProgress(options) {