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 +6 -3
- package/dist/index.js +6 -3
- package/package.json +1 -1
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
|
-
(
|
|
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
|
-
(
|
|
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
|
/**
|