MyCrypto/spec/mocks/localStorage.ts

24 lines
349 B
TypeScript

export default class LocalStorageMock {
private store: object;
constructor() {
this.store = {};
}
public clear() {
this.store = {};
}
public getItem(key) {
return this.store[key];
}
public setItem(key, value) {
this.store[key] = value.toString();
}
public removeItem(key) {
delete this.store[key];
}
}