{"_id":"isostore","_rev":"1-1772088e99285f094fcb0255a6e0df87","name":"isostore","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"isostore","repository":{"type":"git","url":"git+https://github.com/fabiospampinato/isostore.git"},"description":"A simple isomorphic key-value store with a Map-like API for persisting data.","version":"1.0.0","type":"module","main":"dist/node.js","types":"./dist/node.d.ts","sideEffects":false,"exports":{"node":"./dist/node.js","default":"./dist/browser.js"},"scripts":{"clean":"tsex clean","compile":"tsex compile","compile:watch":"tsex compile --watch","test":"tsex test","test:watch":"tsex test --watch","prepublishOnly":"tsex prepare"},"keywords":["isomorphic","key","value","store","storage"],"dependencies":{"atomically":"^2.0.1","memoization-registry":"^1.0.1","when-exit":"^2.1.0"},"devDependencies":{"@types/node":"^18.13.0","fava":"^0.1.2","tsex":"^2.1.0","typescript":"^4.9.5"},"gitHead":"059cd11e0364ad961951b490db217d3cfdf109f2","bugs":{"url":"https://github.com/fabiospampinato/isostore/issues"},"homepage":"https://github.com/fabiospampinato/isostore#readme","_id":"isostore@1.0.0","_nodeVersion":"18.12.0","_npmVersion":"8.19.2","dist":{"integrity":"sha512-MnhxUZYfi6vzq+MSgAziefgMKCVtSX9MUh1JK2qUTw4TSzszJoQfYko48ZoVgycCrSbzIQXBz2eaRA/6D4TlOg==","shasum":"7618d9ccbe6bafac787023191824f2cbb85bd02f","tarball":"https://registry.npmjs.org/isostore/-/isostore-1.0.0.tgz","fileCount":60,"unpackedSize":28088,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDRP+G8plqTaT/Aldw8XoMrOAJFg7ZVpQjvDzRp3HihtAIgJapeyjQWSFcWhUdmhGmlEWP8DLjfaiLd5hGwXQoeZ1Q="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj7Dc2ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo8lxAAjflyzfjRL6aRTEcCiL9HCbVqfkuD+0M7dxyzA7SAYg6r8mtE\r\ne+6lRdkK4OgBZyWxxAQhCiIvyWCIVCBjiNSYpvQ4sJEuyUjOaOcHc7oKsp2f\r\ngWae2mlFuCP3X8BXmiL8AkHNpoiO/jsCNdyvwewST8TVU6yAj8A3v55GD/Wn\r\nJknjxWClmx/0LRH9hcZ8QTinsiFNyja/fDY0KRKO2M4BZX9pXhb7z4QslNzZ\r\n5s/5cdZYn01clADk7nCfdnNBdLC8PprgIyZTW5OkoOtqqUO48UmgGIa97OKo\r\nXNFzCuVWwstSNRvhvjeMVYhY950+ez/AwBMqtDzMiXm8w/vaNbnlvuv5+iVY\r\nGJh5j7aRNXFzQG9oph0H8vNG6Kev/4K6CfGQsrHKOXAYVss4S8mBlTepvHPE\r\nWhviM3TKekMmKRO6+7KeK1CsgAYC/GVknmGZjHtEA0Ss1F1Xv+r4uTfbp1gT\r\n9fPz4+2/vkx1C+88kDXMZEqoAOrpiXuiWK0Prc/ifbI28Tfrzg41XyFKYzS6\r\nwyf9HiXaAJrkMnOYo+eMpnytJYy40kVfhOi87aJlNSqMW5eGVAJnJ2oayPCf\r\nQyHywPOT0wMyxags5FqCTWx7KRSXRP5+GhyfpqsBs0IJjkxPOsb9CJHRdhex\r\nF0c18ody2K3T8KweihvJpAYhwTxU+5OTLVE=\r\n=S5Op\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"fabiospampinato","email":"spampinabio@gmail.com"},"directories":{},"maintainers":[{"name":"fabiospampinato","email":"spampinabio@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/isostore_1.0.0_1676425014159_0.6613261185070998"},"_hasShrinkwrap":false},"1.0.1":{"name":"isostore","repository":{"type":"git","url":"git+https://github.com/fabiospampinato/isostore.git"},"description":"A simple isomorphic key-value store with a Map-like API for persisting data.","version":"1.0.1","type":"module","main":"dist/node.js","types":"./dist/node.d.ts","sideEffects":false,"exports":{"node":"./dist/node.js","default":"./dist/browser.js"},"scripts":{"clean":"tsex clean","compile":"tsex compile","compile:watch":"tsex compile --watch","test":"tsex test","test:watch":"tsex test --watch","prepublishOnly":"tsex prepare"},"keywords":["isomorphic","key","value","store","storage"],"dependencies":{"atomically":"^2.0.3","memoization-registry":"^1.0.1","when-exit":"^2.1.1"},"devDependencies":{"@types/node":"^20.4.9","fava":"^0.2.1","tsex":"^3.0.1","typescript":"^5.1.6"},"_id":"isostore@1.0.1","gitHead":"a1457d82ce14e27f130bbc2ca1c596541ce58e24","bugs":{"url":"https://github.com/fabiospampinato/isostore/issues"},"homepage":"https://github.com/fabiospampinato/isostore#readme","_nodeVersion":"18.19.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-lQ5b0sixi0lvllsAWr/brLMKGKoxj72Us2sXMvHMEa/yxJSmmGNFSO8GBcorykgFtESnuMo7cfLg3V8xLLZEkQ==","shasum":"96749d4b7ce01120984d9a2450ad72691b891446","tarball":"https://registry.npmjs.org/isostore/-/isostore-1.0.1.tgz","fileCount":60,"unpackedSize":28032,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE6iCAo6XZNmrxnYUNlNK/Sywvrn6Q+VjebNXeXtg4r2AiEAidv6PhTzfkFrpKak6ZQyHCkdH9WAm4x7gj47arpXzvs="}]},"_npmUser":{"name":"fabiospampinato","email":"spampinabio@gmail.com"},"directories":{},"maintainers":[{"name":"fabiospampinato","email":"spampinabio@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/isostore_1.0.1_1712275602618_0.6291006550491611"},"_hasShrinkwrap":false}},"time":{"created":"2023-02-15T01:36:54.159Z","1.0.0":"2023-02-15T01:36:54.331Z","modified":"2024-04-05T00:06:42.949Z","1.0.1":"2024-04-05T00:06:42.781Z"},"maintainers":[{"name":"fabiospampinato","email":"spampinabio@gmail.com"}],"description":"A simple isomorphic key-value store with a Map-like API for persisting data.","homepage":"https://github.com/fabiospampinato/isostore#readme","keywords":["isomorphic","key","value","store","storage"],"repository":{"type":"git","url":"git+https://github.com/fabiospampinato/isostore.git"},"bugs":{"url":"https://github.com/fabiospampinato/isostore/issues"},"readme":"# IsoStore\n\nA simple isomorphic key-value store with a Map-like API for persisting data.\n\n## Features\n\n- All stores run everywhere, they just have different backends under the hood.\n- All stores are not intended for performance-critical use cases, since the entire store is saved when a change is made in it.\n- Store saves are batched automatically within a microtask, so performance is not as bad as it could be.\n- When instantiating multiple stores of the same type and with the same id you'll actually always receive the same instance back.\n- Only alphanumeric store ids are allowed, the library will throw on invalid ids.\n\n## Stores\n\nThe following stores are provided:\n\n- `AbstractStore`: A generic store with no backend, for using a custom persistence mechanism.\n- `MemoryStore`: An in-memory store, useful if you don't need persistence, but you want to use the same API.\n- `LocalStore`: A store for persisting data reliably and indefinitely.\n  - Node: it will atomically write a file to disk, in a non-temporary path that depends on your OS.\n  - Browser: it will use the `localStorage` API.\n- `SessionStore`: A store per persisting data somewhat unreliably and/or not indefinitely.\n  - Node: it will non-atomically write a temporary file to disk, which could be deleted at any time.\n  - Browser: it will use the `sessionStorage` API.\n\n## Install\n\n```sh\nnpm install --save isostore\n```\n\n## Usage\n\n```ts\nimport {AbstractStore, LocalStore, MemoryStore, SessionStore} from 'isostore';\n\n// Creating a local store, for indefinite persistence\n\nconst store = new LocalStore ( 'my-store' ); // The id of the store decides the name of the file on disk\n\nstore.has ( 'foo' ); // => false\nstore.set ( 'foo', 'some_string' ); // => store\nstore.get ( 'foo' ); // => 'some_string'\nstore.delete ( 'foo' ); // => true\n\n// Creating another local store, with the same id\n\nconst store2 = new LocalStore ( 'my-store' );\n\nconsole.log ( store === store2 ); // => true, with 🌈 magic 🌈\n\n// Creating a session store, for temporary persistence\n\nconst store3 = new SessionStore ( 'my-store' );\n\n// Creating an in-memory store, for no persistence\n\nconst store4 = new MemoryStore ();\n\n// Creating a custom store, with a custom backend\n\nconst MY_BACKEND = { // It's important to define this outside of the store class\n  read ( id ) {\n    // Return a [string, string][]\n  },\n  write ( id, entries ) {\n    // Write the entries somewhere\n  }\n};\n\nclass MyStore extends AbstractStore {\n  constructor ( id ) {\n    super ({\n      id,\n      backend: MY_BACKEND\n    });\n  }\n}\n\nconst store5 = new MyStore ( 'my-store' );\n```\n\n## License\n\nMIT © Fabio Spampinato\n","readmeFilename":"readme.md"}