A node module (with full Typescript support) to emulate localStorage
and/or sessionStorage outside the browser.
(A major use case being unit tests)
npm install mockstorage
or
yarn add mockstorage
In Javascript
var MockStorage = require('mockstorage').MockStorage
var myStore = new MockStorage()
myStore.setItem('myKey', 'some value')
console.log(myStore.getItem('myKey')) // > 'some value'
In Typescript
import { MockStorage } from 'mockstorage'
const myStore = new MockStorage()
myStore.setItem('myKey', 'some value')
console.log(myStore.getItem('myKey')) // > 'some value'
This project is licensed under the MIT license (a copy of which is part of the project)
Copyright (c) 2017, Arnav Gupta
Generated using TypeDoc