{"name":"node-storage-shim","version":"2.0.0","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.1.2","mocha":"^5.2.0"},"engines":{"node":">=6.14.4"},"gitHead":"969629dcf5de1bee54c57a73d0fb13776f5e2b3d","homepage":"https://github.com/mnahkies/node-storage-shim#readme","_id":"node-storage-shim@2.0.0","_npmVersion":"6.1.0","_nodeVersion":"9.11.2","_npmUser":{"name":"mnahkies","email":"info@nahkies.co.nz"},"dist":{"integrity":"sha512-aFwsD5axX8TU0pjtBKpuJQlofItS7Xgv2GA8woDse9tucf/sYkbaPIyASiMUt4I2kWOhzk7WzGbdZPwIGuPXHA==","shasum":"e9cc8d6fee5b14779645d36515311d79ff987ce2","tarball":"http://registry-npm.ywwl.com/node-storage-shim/download/node-storage-shim-2.0.0.tgz","fileCount":5,"unpackedSize":5195,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJblqyRCRA9TVsSAnZWagAAsbEP/2LSU9kMqxcvL+eOlvv1\n5cBavulQxqyijwVFhlUcpN/SfFTaubtPFX1RVmHskBAzpuTdSz5AorCNyCrb\nzajy2vzKddkwbnbtjweyiVo7ihvx51dN8ltIc52NCW2QkbZY7jz+M6nmhnVj\nMpINJ5S0rjXm44cWHIXzFB9UUCUNnpIcTdC2x6KaBSI9n1UaV4FABI0kKFw1\nRdc6uVkKRKogPRdOIhX5AY9uzNu2hqHwi/ESZViCQgpC3y6zPu3XIqpfqfob\n5e2p6k3qJrxVBDscem24e5FyKGrqEMHmyAOSAYelhWPDZDq66jHLpGjCtov1\njOFbomHeB81lQ/6CzlktJDNbpF4RWyCKZBG6uXLC9nF+OvRuSsZAXGfQ1dZx\nqAj3OSQlf+OiHgosks0KP0NeAReOgBeIGNOWk+MoLaLTjHQsTwmLM8iCvdeK\nuh3XnvcyAKTqH4VwR/Tiaz2WPabh7rF6i1iEeDjX994V/MqsPjl5M/6MgfL1\nmRVifsL9ADfUXHdECQsprLO4xQ4T4acrlS4L+Za/HKR0vbYH3ar5WRoqXgtI\nec4SbenRj+oMuxiNVvXOMNwVKzI+0ySN+09zkeEykNOoNkb/5mFkhqgeV38/\niw7W3QBZUiZErvPnm4bXpc/5fE0ua0e9DAxLSyqOTv+pSGhpDHbfI6glW+k/\nBYYa\r\n=tyGx\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF6C8vYhihQLdf53ps9YCCMqhcy0z78zj6Y4H+BV6+wUAiALJ2ZcdQTMrQYF+/ky1gMyEwrc9SRtTDxAxZ5EUjWD3A=="}],"size":2303,"noattachment":false,"key":"/node-storage-shim/-/node-storage-shim-2.0.0.tgz"},"maintainers":[{"name":"mnahkies","email":"info@nahkies.co.nz"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/node-storage-shim_2.0.0_1536601232607_0.3915725537176937"},"_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":1536601232793,"_cnpm_publish_time":1536601232793,"dist-tags":{"latest":"2.0.1"}}