Reformat
This commit is contained in:
@@ -8,9 +8,7 @@ function fromLocalStorage(storageKey, fallback) {
|
||||
if (browser) {
|
||||
const storedValue = localStorage.getItem(storageKey);
|
||||
if (storedValue !== 'undefined' && storedValue !== null) {
|
||||
return typeof fallback === 'object'
|
||||
? JSON.parse(storedValue)
|
||||
: storedValue;
|
||||
return typeof fallback === 'object' ? JSON.parse(storedValue) : storedValue;
|
||||
}
|
||||
}
|
||||
return fallback;
|
||||
@@ -19,8 +17,7 @@ function fromLocalStorage(storageKey, fallback) {
|
||||
function toLocalStorage(store, storageKey) {
|
||||
if (browser) {
|
||||
store.subscribe((value) => {
|
||||
let storageValue =
|
||||
typeof value === 'object' ? JSON.stringify(value) : value;
|
||||
let storageValue = typeof value === 'object' ? JSON.stringify(value) : value;
|
||||
|
||||
localStorage.setItem(storageKey, storageValue);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user