diff options
Diffstat (limited to 'packages/website/ts/local_storage/local_storage.ts')
-rw-r--r-- | packages/website/ts/local_storage/local_storage.ts | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/packages/website/ts/local_storage/local_storage.ts b/packages/website/ts/local_storage/local_storage.ts index d94e6877b..4e5b77a0a 100644 --- a/packages/website/ts/local_storage/local_storage.ts +++ b/packages/website/ts/local_storage/local_storage.ts @@ -1,35 +1,35 @@ import * as _ from 'lodash'; export const localStorage = { - doesExist() { - return !!window.localStorage; - }, - getItemIfExists(key: string): string { - if (!this.doesExist) { - return undefined; - } - const item = window.localStorage.getItem(key); - if (_.isNull(item) || item === 'undefined') { - return ''; - } - return item; - }, - setItem(key: string, value: string) { - if (!this.doesExist || _.isUndefined(value)) { - return; - } - window.localStorage.setItem(key, value); - }, - removeItem(key: string) { - if (!this.doesExist) { - return; - } - window.localStorage.removeItem(key); - }, - getAllKeys(): string[] { - if (!this.doesExist) { - return []; - } - return _.keys(window.localStorage); - }, + doesExist() { + return !!window.localStorage; + }, + getItemIfExists(key: string): string { + if (!this.doesExist) { + return undefined; + } + const item = window.localStorage.getItem(key); + if (_.isNull(item) || item === 'undefined') { + return ''; + } + return item; + }, + setItem(key: string, value: string) { + if (!this.doesExist || _.isUndefined(value)) { + return; + } + window.localStorage.setItem(key, value); + }, + removeItem(key: string) { + if (!this.doesExist) { + return; + } + window.localStorage.removeItem(key); + }, + getAllKeys(): string[] { + if (!this.doesExist) { + return []; + } + return _.keys(window.localStorage); + }, }; |