1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-10-30 08:10:34 +01:00

Update storageService implementations (#1033)

* Add htmlStorageService.has

* Add memoryStorageService.has
This commit is contained in:
Thomas Rittson 2021-06-15 14:34:54 -07:00 committed by GitHub
parent 7c64c812fc
commit 44bf90cf6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -44,6 +44,10 @@ export class HtmlStorageService implements StorageService {
return Promise.resolve(null); return Promise.resolve(null);
} }
async has(key: string): Promise<boolean> {
return this.get(key) != null;
}
save(key: string, obj: any): Promise<any> { save(key: string, obj: any): Promise<any> {
if (obj == null) { if (obj == null) {
return this.remove(key); return this.remove(key);

View File

@ -11,6 +11,10 @@ export class MemoryStorageService implements StorageService {
return Promise.resolve(null); return Promise.resolve(null);
} }
async has(key: string): Promise<boolean> {
return this.get(key) != null;
}
save(key: string, obj: any): Promise<any> { save(key: string, obj: any): Promise<any> {
if (obj == null) { if (obj == null) {
return this.remove(key); return this.remove(key);