Skip to content

Commit

Permalink
Code optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
cedx committed Jul 25, 2024
1 parent 9e4db29 commit ee2a8fb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class Storage extends EventTarget {
*/
get keys(): Set<string> {
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);
}

/**
Expand Down

0 comments on commit ee2a8fb

Please sign in to comment.