{"_id":"dom-storage","_rev":"1721308","name":"dom-storage","description":"W3C DOM Storage (localStorage and sessionStorage) for node.js","dist-tags":{"latest":"2.1.0"},"maintainers":[{"name":"npm:coolaj86","email":""}],"time":{"modified":"2021-11-29T01:31:00.000Z","created":"2012-05-19T21:38:50.289Z","2.1.0":"2018-03-28T05:16:11.625Z","2.0.2":"2016-01-21T18:12:04.104Z","2.0.1":"2014-03-08T21:55:51.404Z","2.0.0":"2014-01-29T01:22:29.223Z","1.0.2":"2013-01-26T09:10:59.111Z","1.0.0":"2012-05-19T21:38:50.289Z"},"users":{"lgh06":true,"cedx":true},"author":{"name":"AJ ONeal","email":"coolaj86@gmail.com","url":"https://coolaj86.com"},"repository":{"type":"git","url":"git://git.coolaj86.com/coolaj86/dom-storage.js.git"},"versions":{"2.1.0":{"author":{"name":"AJ ONeal","email":"coolaj86@gmail.com","url":"https://coolaj86.com"},"homepage":"https://git.coolaj86.com/coolaj86/dom-storage.js","name":"dom-storage","description":"W3C DOM Storage (localStorage and sessionStorage) for node.js","version":"2.1.0","repository":{"type":"git","url":"git://git.coolaj86.com/coolaj86/dom-storage.js.git"},"engines":{"node":"*"},"main":"lib/index.js","dependencies":{},"license":"(MIT or Apache-2.0)","devDependencies":{},"gitHead":"2dedfc50e65231aa918b3822350e6f484b64b8c8","_id":"dom-storage@2.1.0","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"coolaj86","email":"coolaj86@gmail.com"},"dist":{"shasum":"00fb868bc9201357ea243c7bcfd3304c1e34ea39","size":6331,"noattachment":false,"key":"/dom-storage/-/dom-storage-2.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/dom-storage/download/dom-storage-2.1.0.tgz"},"maintainers":[{"name":"npm:coolaj86","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/dom-storage_2.1.0_1522214171542_0.7843371679370785"},"_hasShrinkwrap":false,"publish_time":1522214171625,"_cnpm_publish_time":1522214171625},"2.0.2":{"author":{"name":"AJ ONeal","email":"coolaj86@gmail.com","url":"http://coolaj86.info"},"name":"dom-storage","description":"W3C DOM Storage (localStorage and sessionStorage) for Node.JS","version":"2.0.2","repository":{"type":"git","url":"git://github.com/coolaj86/node-dom-storage.git"},"engines":{"node":"*"},"main":"lib/index.js","dependencies":{},"license":"Apache2","devDependencies":{},"gitHead":"5670628570c7d744bd78735788f7fd8c7e3870bc","bugs":{"url":"https://github.com/coolaj86/node-dom-storage/issues"},"homepage":"https://github.com/coolaj86/node-dom-storage#readme","_id":"dom-storage@2.0.2","scripts":{},"_shasum":"ed17cbf68abd10e0aef8182713e297c5e4b500b0","_from":".","_npmVersion":"3.3.12","_nodeVersion":"5.2.0","_npmUser":{"name":"coolaj86","email":"coolaj86@gmail.com"},"maintainers":[{"name":"npm:coolaj86","email":""}],"dist":{"shasum":"ed17cbf68abd10e0aef8182713e297c5e4b500b0","size":6206,"noattachment":false,"key":"/dom-storage/-/dom-storage-2.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/dom-storage/download/dom-storage-2.0.2.tgz"},"directories":{},"publish_time":1453399924104,"_cnpm_publish_time":1453399924104,"_hasShrinkwrap":false},"2.0.1":{"author":{"name":"AJ ONeal","email":"coolaj86@gmail.com","url":"http://coolaj86.info"},"name":"dom-storage","description":"W3C DOM Storage (localStorage and sessionStorage) for Node.JS","version":"2.0.1","repository":{"type":"git","url":"git://github.com/coolaj86/node-dom-storage.git"},"engines":{"node":"*"},"main":"lib/index.js","dependencies":{},"devDependencies":{},"bugs":{"url":"https://github.com/coolaj86/node-dom-storage/issues"},"homepage":"https://github.com/coolaj86/node-dom-storage","_id":"dom-storage@2.0.1","dist":{"shasum":"f0e820f85f79034ac410a3c2573c4d69c4134aab","size":2599,"noattachment":false,"key":"/dom-storage/-/dom-storage-2.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/dom-storage/download/dom-storage-2.0.1.tgz"},"_from":"./","_npmVersion":"1.3.24","_npmUser":{"name":"coolaj86","email":"coolaj86@gmail.com"},"maintainers":[{"name":"npm:coolaj86","email":""}],"directories":{},"publish_time":1394315751404,"_cnpm_publish_time":1394315751404,"_hasShrinkwrap":false},"2.0.0":{"author":{"name":"AJ ONeal","email":"coolaj86@gmail.com","url":"http://coolaj86.info"},"name":"dom-storage","description":"W3C DOM Storage (localStorage and sessionStorage) for Node.JS","version":"2.0.0","repository":{"type":"git","url":"git://github.com/coolaj86/node-dom-storage.git"},"engines":{"node":"*"},"main":"lib/index.js","dependencies":{},"devDependencies":{},"bugs":{"url":"https://github.com/coolaj86/node-dom-storage/issues"},"homepage":"https://github.com/coolaj86/node-dom-storage","_id":"dom-storage@2.0.0","dist":{"shasum":"572d1697c123150f36f15deece2c040ea89e73bc","size":2859,"noattachment":false,"key":"/dom-storage/-/dom-storage-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/dom-storage/download/dom-storage-2.0.0.tgz"},"_from":"./","_npmVersion":"1.3.22","_npmUser":{"name":"coolaj86","email":"coolaj86@gmail.com"},"maintainers":[{"name":"npm:coolaj86","email":""}],"directories":{},"publish_time":1390958549223,"_cnpm_publish_time":1390958549223,"_hasShrinkwrap":false},"1.0.2":{"author":{"name":"AJ ONeal","email":"coolaj86@gmail.com","url":"http://coolaj86.info"},"name":"dom-storage","description":"W3C DOM Storage (localStorage and sessionStorage) for Node.JS","version":"1.0.2","repository":{"type":"git","url":"git://github.com/coolaj86/node-browser-compat.git"},"engines":{"node":"*"},"main":"lib/index.js","dependencies":{},"devDependencies":{},"readmeFilename":"README.md","_id":"dom-storage@1.0.2","dist":{"shasum":"0dc2e5b829a83ef75f5b4c4fa895fc8d6c07bfb6","size":2613,"noattachment":false,"key":"/dom-storage/-/dom-storage-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/dom-storage/download/dom-storage-1.0.2.tgz"},"_from":"./","_npmVersion":"1.2.2","_npmUser":{"name":"coolaj86","email":"coolaj86@gmail.com"},"maintainers":[{"name":"npm:coolaj86","email":""}],"directories":{},"publish_time":1359191459111,"_cnpm_publish_time":1359191459111,"_hasShrinkwrap":false},"1.0.0":{"author":{"name":"AJ ONeal","email":"coolaj86@gmail.com","url":"http://coolaj86.info"},"name":"dom-storage","description":"W3C DOM Storage (localStorage and sessionStorage) for Node.JS","version":"1.0.0","repository":{"type":"git","url":"git://github.com/coolaj86/node-browser-compat.git"},"engines":{"node":"*"},"main":"index.js","dependencies":{},"devDependencies":{},"_npmUser":{"name":"coolaj86","email":"coolaj86@gmail.com"},"_id":"dom-storage@1.0.0","optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.21","_nodeVersion":"v0.6.18","_defaultsLoaded":true,"dist":{"shasum":"3a49e4b9f30ada658acc64240282b471bc362f35","size":1148,"noattachment":false,"key":"/dom-storage/-/dom-storage-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/dom-storage/download/dom-storage-1.0.0.tgz"},"maintainers":[{"name":"npm:coolaj86","email":""}],"directories":{},"publish_time":1337463530289,"_cnpm_publish_time":1337463530289,"_hasShrinkwrap":false}},"readme":"sessionStorage & localStorage for NodeJS\n===\n\n| **dom-storage**\n| [atob](https://git.coolaj86.com/coolaj86/atob.js)\n| [btoa](https://git.coolaj86.com/coolaj86/btoa.js)\n| [unibabel.js](https://git.coolaj86.com/coolaj86/unibabel.js)\n| Sponsored by [ppl](https://ppl.family)\n\n\nAn inefficient, but as W3C-compliant as possible using only pure JavaScript, `DOMStorage` implementation.\n\nPurpose\n----\n\nThis is meant for the purpose of being able to run unit-tests and such for browser-y modules in node.\n\nUsage\n----\n\n```javascript\nvar Storage = require('dom-storage');\n\n// in-file, doesn't call `String(val)` on values (default)\nvar localStorage = new Storage('./db.json', { strict: false, ws: '  ' });\n\n// in-memory, does call `String(val)` on values (i.e. `{}` becomes `'[object Object]'`\nvar sessionStorage = new Storage(null, { strict: true });\n\nvar myValue = { foo: 'bar', baz: 'quux' };\n\nlocalStorage.setItem('myKey', myValue);\nmyValue = localStorage.getItem('myKey');\n\n// use JSON to stringify / parse when using strict w3c compliance\nsessionStorage.setItem('myKey', JSON.stringify(myValue));\nmyValue = JSON.parse(localStorage.getItem('myKey'));\n```\n\nAPI\n---\n\n  * getItem(key)\n  * setItem(key, value)\n  * removeItem(key)\n  * clear()\n  * key(n)\n  * length\n\n### Options\n\n  * strict - whether to stringify strictly as text `[Object object]` or as json `{ foo: bar }`.\n  * ws - the whitespace to use saving json to disk. Defaults to `'  '`.\n\nTests\n---\n\n```javascript\n0 === localStorage.length;\nnull === localStorage.getItem('doesn\\'t exist');\nundefined === localStorage['doesn\\'t exist'];\n\nlocalStorage.setItem('myItem');\n'undefined' === localStorage.getItem('myItem');\n1 === localStorage.length;\n\nlocalStorage.setItem('myItem', 0);\n'0' === localStorage.getItem('myItem');\n\nlocalStorage.removeItem('myItem', 0);\n0 === localStorage.length;\n\nlocalStorage.clear();\n0 === localStorage.length;\n```\n\nNotes\n---\n\n  * db is read in synchronously\n  * No callback when db is saved\n  * Doesn't not emit `Storage` events (not sure how to do)\n\nLicense\n-------\n\nCode copyright 2012-2018 AJ ONeal\n\nDual-licensed MIT and Apache-2.0\n\nDocs copyright 2012-2018 AJ ONeal\n\nDocs released under Creative Commons.\n","_attachments":{},"homepage":"https://git.coolaj86.com/coolaj86/dom-storage.js","license":"(MIT or Apache-2.0)"}