{"name":"node-storage-shim","version":"1.0.1","description":"Provides an in memory implementation of the webstorage Storage interface to be used as a shim for localStorage or sessionStorage for unit testing","repository":{"type":"git","url":"https://github.com/mnahkies/node-storage-shim"},"bugs":{"url":"https://github.com/mnahkies/node-storage-shim/issues"},"main":"index.js","scripts":{"test":"mocha test"},"author":{"name":"Michael Nahkies"},"license":"ISC","devDependencies":{"mocha":"^2.2.5"},"gitHead":"8a8116199e597cbe7296add184347a8e441c3fc6","homepage":"https://github.com/mnahkies/node-storage-shim","_id":"node-storage-shim@1.0.1","_shasum":"e1213219a6a38936fa8d4bcead2428ad0a3b1a6c","_from":".","_npmVersion":"2.5.1","_nodeVersion":"0.12.0","_npmUser":{"name":"mnahkies","email":"info@nahkies.co.nz"},"dist":{"shasum":"e1213219a6a38936fa8d4bcead2428ad0a3b1a6c","tarball":"http://registry-npm.ywwl.com/node-storage-shim/download/node-storage-shim-1.0.1.tgz","integrity":"sha512-fuAqzVbH7XwmuDShhyJwb3bJ8cmWwFt0TbmX8PctojvwhRHePwzPStNNuPcCH4RlUDo6K+2D0NMkuRi8rB2+kA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBiECfyYz+nvLcy41Y+M+lUlduSGijgQ2bW6Ynt55VnQAiBk/j1tygT+fICl9999NGjonMKVBbhc6h4KAiyTVL0HDQ=="}],"size":2718,"noattachment":false,"key":"/node-storage-shim/-/node-storage-shim-1.0.1.tgz"},"maintainers":[{"name":"mnahkies","email":"info@nahkies.co.nz"}],"directories":{},"readme":"# node-storage-shim\n\n[![Build Status](https://travis-ci.org/mnahkies/node-storage-shim.svg)](https://travis-ci.org/mnahkies/node-storage-shim)\n[![npm](https://img.shields.io/npm/v/node-storage-shim.svg)](https://www.npmjs.com/package/node-storage-shim)\n\nnode-storage-shim provides a simple shim conforming to the w3c Storage Interface\nthat can be used as a transient replacement for localStorage or sessionStorage\nwhen running in environments that do not support these, eg: node. \n\nNote that this does not persist it's data to disk, and is primarily aimed at \nuse in unit tests.\n\n## Installation\nThe package can be installed from npm:\n\n```shell script\nnpm install --save node-storage-shim\n```\n\n\n## Example Usage\n\n```javascript\nconst StorageShim = require('node-storage-shim')\n\nstorage = new StorageShim()\n\nstorage.setItem(\"foo\", \"My Value\")\nconsole.log(storage.getItem(\"foo\")\n```\n    \n## Polyfill localStorage / sessionStorage\nIf you wish to polyfill the localStorage and sessionStorage globals that are available in \nweb browsers, you can do something like this:\n\n```javascript\nconst StorageShim = require('node-storage-shim')\n\nglobal.window = global\nglobal.localStorage = new StorageShim()\nglobal.sessionStorage = new StorageShim()\n```\n\n    \n## Running Unit Tests\nThe unit tests use mocha, and are setup to run by the standard npm test command.\nThis also runs a sanity test of the typescript declaration in the test-typescript-declarations directory\n\n    npm install\n    npm test\n\n## Limitations\n- You cannot use any of the method names as keys, this is a trade-off that is required to support for ... in iteration.\n\n- storage event portion of the interface is not implemented.\n    \n## Change Log\n\n### 2.0.1 (21-03-2020)\n- Improve readme\n\n### 2.0.0 (10-09-2018)\n- Updated minimum NodeJS version and started using Proxy to fix limitations with respect to direct property access.\n- Added typescript declaration\n\n### 1.0.1 (08/01/2015)\n- Initial release\n\n## Further Reading\n\n[w3c Storage Interface](https://w3c.github.io/webstorage/#storage-0)\n\n[MDN Storage Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Storage)\n","publish_time":1438394835639,"_cnpm_publish_time":1438394835639,"dist-tags":{"latest":"2.0.1"}}