{"name":"node-storage-shim","version":"2.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":"git+https://github.com/mnahkies/node-storage-shim.git"},"bugs":{"url":"https://github.com/mnahkies/node-storage-shim/issues"},"main":"index.js","typings":"index.d.ts","scripts":{"test":"mocha test && ./test-typescript-declarations.sh"},"author":{"name":"Michael Nahkies"},"license":"ISC","devDependencies":{"chai":"^4.2.0","mocha":"^7.1.1"},"engines":{"node":">=6.14.4"},"gitHead":"318f4b32400d559ae53fffb5890da85890b39737","homepage":"https://github.com/mnahkies/node-storage-shim#readme","_id":"node-storage-shim@2.0.1","_nodeVersion":"12.16.1","_npmVersion":"6.13.7","dist":{"integrity":"sha512-ce8enbToMe8iUHDTMCg4rdP1K0syoJrZRO0Dl9uMLPCwlc5M1HKaapV3Pqlv6/3LQNuDiYXBm4rPlj78MeUSSA==","shasum":"6d5852f22700c2ccb48537f41a26ebea7c365b6e","tarball":"http://registry-npm.ywwl.com/node-storage-shim/download/node-storage-shim-2.0.1.tgz","fileCount":5,"unpackedSize":5756,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJedixxCRA9TVsSAnZWagAA43UP/0H22zDl0uw7hfpAxp6r\nE+yFhiB2Ga/5xfejKwWxmGn1YEtnoheK3njaBXBIKT2pRaYZ4TQO2RqNxbtf\n+czaItK0VdVqO17dCrCWW0oXui6gcG3rzlsmEd6ybI5RQaCl/K6To6VjvGyp\niy1/YKkxY6LgUnIbdRIGq326nL1uxlSG/NSf6NtrgtpD9t4mmcqhjBSKUYFd\nSUEBkoAiqrz9KLILs6XHJU+XS4+k17JTkMqSwSAb1C1uIs+/2t0H9RSMmAHH\niZPJzGIasoF2lTxywFxbu9hKVojobvz2woo5bNaevAzjLz4z2Jo4cPEG1i5J\ncQnZyiCiGp+m3UWfW3pAox/LI/NzYLSV5HZ2m63R4UlPNY5JTbHo6zeHiQYE\np+X4+TOdsWXREg54Uyu5nD0xX+YqrSef1I0Oz55MgWAxkoz87f9DX8Omhc/I\n4rIe+KM9JuVSuH/RQ1rSxwLyQ8h/EHYHKzzfGynt1QWtCHiWnq3AM/0tJPXe\nTpF/BUtw+0qDHXPHuqTorBzaEJR0R79l7fBeb1lj5K/QmBw0zEOWvBPiRVLQ\nMpzwqFYywsjE4OCKfs+SYEDn2n3dXcSias0b1OIXBsoGiAONYxItAxltX4Ba\nNxr1XIge6y9Bic+8/RoPHGZVxtGda7JvuqXxcbf8HBDswhirgpk1GDDdtHaO\ngwdU\r\n=7m+p\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF0w+ncEduf+EG1DJx7WAoiAzeqps/U3ldpK1sWHxN+9AiAKabC+ZdGEjPLDS21WBghRK3D5LA9MnDKa9JKq0E0m1w=="}],"size":2516,"noattachment":false,"key":"/node-storage-shim/-/node-storage-shim-2.0.1.tgz"},"maintainers":[{"name":"mnahkies","email":"info@nahkies.co.nz"}],"_npmUser":{"name":"mnahkies","email":"support@nahkies.co.nz"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/node-storage-shim_2.0.1_1584802928771_0.9784424994900716"},"_hasShrinkwrap":false,"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":1584802928884,"_cnpm_publish_time":1584802928884,"dist-tags":{"latest":"2.0.1"}}