mockstorage
TypeScript icon, indicating that this package has built-in type declarations

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

Package Sidebar

Install

npm i mockstorage

Weekly Downloads

6

Version

0.1.4

License

MIT

Last publish

Collaborators

  • championswimmer