Get unlimited public & private packages + team-based management with npm Teams.Learn more »

mockstorage

0.1.4 • Public • Published

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

Install

npm i mockstorage

DownloadsWeekly Downloads

33

Version

0.1.4

License

MIT

Last publish

Collaborators

  • avatar