hono-rate-limiter 0.5.2 → 0.5.3

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
@@ -525,9 +525,12 @@ class UnstorageStore {
525
525
  * @returns {ClientRateLimitInfo | undefined} - The number of hits and reset time for that client.
526
526
  */
527
527
  async get(key) {
528
- const result = await this.storage.get(this.prefixKey(key)).then(
529
- (value) => value ? JSON.parse(String(value)) : void 0
530
- );
528
+ const result = await this.storage.get(this.prefixKey(key)).then((value) => {
529
+ if (typeof value === "object") {
530
+ return value;
531
+ }
532
+ return value ? JSON.parse(String(value)) : void 0;
533
+ });
531
534
  return result;
532
535
  }
533
536
  /**
package/dist/index.js CHANGED
@@ -523,9 +523,12 @@ class UnstorageStore {
523
523
  * @returns {ClientRateLimitInfo | undefined} - The number of hits and reset time for that client.
524
524
  */
525
525
  async get(key) {
526
- const result = await this.storage.get(this.prefixKey(key)).then(
527
- (value) => value ? JSON.parse(String(value)) : void 0
528
- );
526
+ const result = await this.storage.get(this.prefixKey(key)).then((value) => {
527
+ if (typeof value === "object") {
528
+ return value;
529
+ }
530
+ return value ? JSON.parse(String(value)) : void 0;
531
+ });
529
532
  return result;
530
533
  }
531
534
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hono-rate-limiter",
3
3
  "description": "Rate limit middleware for Hono.",
4
- "version": "0.5.2",
4
+ "version": "0.5.3",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "keywords": [