All Projects → capaj → localstorage-polyfill

capaj / localstorage-polyfill

Licence: MIT License
in memory localStorage polyfill for node.js utilizing ES6 proxies

Programming Languages

javascript
184084 projects - #8 most used programming language

localstorage-polyfill

in memory localStorage polyfill for node.js utilizing ES6 proxies(requires node.js 6 at least)

Installation

npm i localstorage-polyfill -D

Saving for development, because primarily this package is meant for unit testing browser in node.js.

Usage

require('localstorage-polyfill')
// or
import 'localstorage-polyfill'
global.localStorage // now has your in memory localStorage

For API doc, refer to MDN.

There are other packages like node-localStorage, but none of them work properly when you do

localStorage.c = 1

They only shim the methods of localStorage object, they don't imitate it's behaviour fully.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].