From ee2a8fbd31405ad8217b305ca90303f6d6487da5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Belin?= Date: Thu, 25 Jul 2024 11:54:55 +0200 Subject: [PATCH] Code optimization --- src/storage.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/storage.ts b/src/storage.ts index 8421e19..5f5cdb6 100644 --- a/src/storage.ts +++ b/src/storage.ts @@ -32,7 +32,7 @@ export class Storage extends EventTarget { */ get keys(): Set { const keys = Array.from(Array(this.#backend.length), (_, index) => this.#backend.key(index)!); - return new Set(keys.filter(key => key.startsWith(this.#keyPrefix)).map(key => key.slice(this.#keyPrefix.length))); + return new Set(this.#keyPrefix ? keys.filter(key => key.startsWith(this.#keyPrefix)).map(key => key.slice(this.#keyPrefix.length)) : keys); } /**