Skip to content

Commit

Permalink
lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
goatandsheep committed Aug 6, 2020
1 parent 93906a8 commit f3ad4b9
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ let FlattedJSON = JSON
*/
export class VuexPersistence<S> implements PersistOptions<S> {
public asyncStorage: boolean
public storage: Storage | AsyncStorage
public storage: Storage | AsyncStorage | undefined
public restoreState: (key: string, storage?: AsyncStorage | Storage) => Promise<S> | S
public saveState: (key: string, state: {}, storage?: AsyncStorage | Storage) => Promise<void> | void
public reducer: (state: S) => Partial<S>
Expand Down Expand Up @@ -59,18 +59,12 @@ export class VuexPersistence<S> implements PersistOptions<S> {
let localStorageLitmus = true

try {
window.localStorage
window.localStorage.getItem('')
} catch (err) {
localStorageLitmus = false
}

const storage = options.storage || localStorageLitmus && window.localStorage || MockStorage && new MockStorage()

if (storage) {
this.storage = storage
} else {
throw new Error('No storage options available')
}
this.storage = options.storage || localStorageLitmus && window.localStorage || MockStorage && new MockStorage()

/**
* How this works is -
Expand Down Expand Up @@ -101,7 +95,7 @@ export class VuexPersistence<S> implements PersistOptions<S> {

this.RESTORE_MUTATION = function RESTORE_MUTATION(state: S, savedState: any) {
const mergedState = merge(state, savedState || {})
for (let propertyName of Object.keys(mergedState)) {
for (const propertyName of Object.keys(mergedState)) {
(this as any)._vm.$set(state, propertyName, mergedState[propertyName])
}
}
Expand Down

0 comments on commit f3ad4b9

Please sign in to comment.