From 44bf90cf6a368fcb9a29d616d6ef442748f45736 Mon Sep 17 00:00:00 2001 From: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Date: Tue, 15 Jun 2021 14:34:54 -0700 Subject: [PATCH] Update storageService implementations (#1033) * Add htmlStorageService.has * Add memoryStorageService.has --- src/services/htmlStorage.service.ts | 4 ++++ src/services/memoryStorage.service.ts | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/services/htmlStorage.service.ts b/src/services/htmlStorage.service.ts index 53f9fa50f3..5e44abc38b 100644 --- a/src/services/htmlStorage.service.ts +++ b/src/services/htmlStorage.service.ts @@ -44,6 +44,10 @@ export class HtmlStorageService implements StorageService { return Promise.resolve(null); } + async has(key: string): Promise { + return this.get(key) != null; + } + save(key: string, obj: any): Promise { if (obj == null) { return this.remove(key); diff --git a/src/services/memoryStorage.service.ts b/src/services/memoryStorage.service.ts index 6b4b546674..960678ba0e 100644 --- a/src/services/memoryStorage.service.ts +++ b/src/services/memoryStorage.service.ts @@ -11,6 +11,10 @@ export class MemoryStorageService implements StorageService { return Promise.resolve(null); } + async has(key: string): Promise { + return this.get(key) != null; + } + save(key: string, obj: any): Promise { if (obj == null) { return this.remove(key);