0.1.4 • Published 7 years ago

mockstorage v0.1.4

Weekly downloads
9
License
MIT
Repository
github
Last release
7 years ago

mockstorage

A node module (with full Typescript support) to emulate localStorage and/or sessionStorage outside the browser.
(A major use case being unit tests)

Build Status codecov Codacy Badge codebeat badge Code Climate

Installation

npm install mockstorage

or

yarn add mockstorage

Usage

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' 

LICENSE

This project is licensed under the MIT license (a copy of which is part of the project)

Copyright (c) 2017, Arnav Gupta