Skip to content
in memory localStorage polyfill for node.js utilizing ES6 proxies
Branch: master
Clone or download
Latest commit 12505a9 Nov 14, 2016
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Initial commit Aug 18, 2016
LICENSE Initial commit Aug 18, 2016
README.md Update README.md Nov 14, 2016
localStorage.js added missing use strict declaration Sep 14, 2016
localStorage.spec.js
package.json

README.md

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.

You can’t perform that action at this time.