{"_id":"@bonny-kato/localstorage","_rev":"1-e705706792e3de1d5b0f77d8ba76f465","name":"@bonny-kato/localstorage","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.1":{"name":"@bonny-kato/localstorage","version":"0.0.1","description":"","main":"dist/cjs/index.js","module":"dist/esm/index.js","types":"dist/index.d.ts","scripts":{"build":"rollup -c"},"keywords":["local-storage","storage","db","browser storage"],"author":{"name":"Bonny Kato"},"devDependencies":{"@rollup/plugin-alias":"^5.1.0","@rollup/plugin-commonjs":"^25.0.7","@rollup/plugin-node-resolve":"^15.2.3","@rollup/plugin-terser":"^0.4.4","@rollup/plugin-typescript":"^11.1.6","@types/node":"^20.11.17","@types/react":"^18.2.56","husky":"^9.0.11","prettier":"^3.2.5","rollup":"^4.10.0","rollup-plugin-dts":"^6.1.0","rollup-plugin-node-polyfills":"^0.2.1","tslib":"^2.6.2","typescript":"^5.3.3"},"repository":{"type":"git","url":"git://github.com/Bonny-kato/local-storage.git"},"license":"ISC","_id":"@bonny-kato/localstorage@0.0.1","gitHead":"61b9fd311b884fb4c23ebe439f51dd7ba75f21da","bugs":{"url":"https://github.com/Bonny-kato/local-storage/issues"},"homepage":"https://github.com/Bonny-kato/local-storage#readme","_nodeVersion":"18.17.1","_npmVersion":"10.3.0","dist":{"integrity":"sha512-Yr30mZwIrBySg/gO5d+H50paOzfFibdEPDiIks0/XAKJxVNismPOG+aYAKr+eIVK8U5W8MrFpcKsdrPDGpWT2g==","shasum":"bb80fdd08de3f8f3dad3ef677e31caedf24419dd","tarball":"https://registry.npmjs.org/@bonny-kato/localstorage/-/localstorage-0.0.1.tgz","fileCount":7,"unpackedSize":9312,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDxqLyqNkNzCzmnwsmlo73+d7MVHYk/ff11Gf583ixYhgIhAOF9PfztDnAbjCtC1NWTVtJkCZHjv8+eFrW2pMt2DPzr"}]},"_npmUser":{"name":"bonny-kato","email":"6onnykato@gmail.com"},"directories":{},"maintainers":[{"name":"bonny-kato","email":"6onnykato@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/localstorage_0.0.1_1711092861336_0.4832016087573816"},"_hasShrinkwrap":false},"0.0.2":{"name":"@bonny-kato/localstorage","version":"0.0.2","description":"A highly efficient and user-friendly wrapper library for the browser's LocalStorage API. This robust tool abstracts away the intricacies of dealing with client-side storage, offering an intuitive way to manage data persistence in a user's browser.","main":"dist/cjs/index.js","module":"dist/esm/index.js","types":"dist/index.d.ts","scripts":{"build":"rollup -c"},"keywords":["local-storage","storage","db","browser storage"],"author":{"name":"Bonny Kato","email":"6onnykato@gmail.com","url":"https://bonny-kato.github.io"},"devDependencies":{"@rollup/plugin-alias":"^5.1.0","@rollup/plugin-commonjs":"^25.0.7","@rollup/plugin-node-resolve":"^15.2.3","@rollup/plugin-terser":"^0.4.4","@rollup/plugin-typescript":"^11.1.6","@types/node":"^20.11.17","@types/react":"^18.2.56","husky":"^9.0.11","prettier":"^3.2.5","rollup":"^4.10.0","rollup-plugin-dts":"^6.1.0","rollup-plugin-node-polyfills":"^0.2.1","tslib":"^2.6.2","typescript":"^5.3.3"},"repository":{"type":"git","url":"git://github.com/Bonny-kato/local-storage.git"},"license":"ISC","_id":"@bonny-kato/localstorage@0.0.2","gitHead":"b80d2a49b297506fe6da443f3e680d55a60e0ef7","bugs":{"url":"https://github.com/Bonny-kato/local-storage/issues"},"homepage":"https://github.com/Bonny-kato/local-storage#readme","_nodeVersion":"18.17.1","_npmVersion":"10.3.0","dist":{"integrity":"sha512-nUNzGxvuArRhPQAQGCzuaGwyaxshWQ3TTERHT1WkoYW8b7G7CNJsbqX0iOqL/0Yv7JT6pOvvJ3INyV6xrtd6lA==","shasum":"6d160964d821590485f61762d6fe54fa7ae5c925","tarball":"https://registry.npmjs.org/@bonny-kato/localstorage/-/localstorage-0.0.2.tgz","fileCount":7,"unpackedSize":15263,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF3jJtEt+hdOP0Oi+iyAgroojDmpEl32E4xA4NFFoLg6AiAxaYMzcQWNgytD3jW7Z1LoFL9VAtwoi9am9YkPxh4yfw=="}]},"_npmUser":{"name":"bonny-kato","email":"6onnykato@gmail.com"},"directories":{},"maintainers":[{"name":"bonny-kato","email":"6onnykato@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/localstorage_0.0.2_1712045067349_0.12153850671729516"},"_hasShrinkwrap":false}},"time":{"created":"2024-03-22T07:34:21.230Z","0.0.1":"2024-03-22T07:34:21.506Z","modified":"2024-04-02T08:04:27.670Z","0.0.2":"2024-04-02T08:04:27.497Z"},"maintainers":[{"name":"bonny-kato","email":"6onnykato@gmail.com"}],"homepage":"https://github.com/Bonny-kato/local-storage#readme","keywords":["local-storage","storage","db","browser storage"],"repository":{"type":"git","url":"git://github.com/Bonny-kato/local-storage.git"},"author":{"name":"Bonny Kato","email":"6onnykato@gmail.com","url":"https://bonny-kato.github.io"},"bugs":{"url":"https://github.com/Bonny-kato/local-storage/issues"},"license":"ISC","readme":"### Overview\n\n\n`@bonny-kato/localstorage` is a highly efficient and user-friendly wrapper library for the browser's LocalStorage API. This robust tool abstracts away the intricacies of dealing with client-side storage, offering an intuitive way to manage data persistence in a user's browser.\n\nFitted with methods for storing, retrieving, and removing data, this library brings an unparalleled level of convenience to interaction with local storage. Its design accommodates single and batch operations, allowing the setting and removal of multiple key-value pairs at once.\n\nBeyond these, it also offers unique key management to circumvent potential key conflicts, lending itself useful during local development. To add to this, `@bonny-kato/localstorage` is Server-Side Rendering (SSR) compatible, catering for a variety of development scenarios.\n\nFor those diving into local storage operations for the first time or developers looking to streamline their data persistence process, `@bonny-kato/localstorage` is the library of choice.\n\n\n\n\n### Installation\n\n```bash\nnpm i @bonny-kato/localstorage\n```\n```bash\nyarn add @bonny-kato/localstorage\n```\n\n\n### Usage\n\n#### Methods\n\n- `getValue(key: string | null = null, defaultValue?: any): any`: Retrieves the value stored in the local storage for the given key. If no key is provided, it returns the entire store. If the key doesn't exist, it returns the provided defaultValue or null.\n\n- `setValue(key: string, value: string | boolean | Array<any> | object): void`: Sets the value for a given key in the local storage. If the key already exists, its value will be updated.\n\n- `setValues(data: object): void`: Sets multiple key-value pairs at once in the local storage.\n\n- `removeValues(keys: string | Array<string>): void`: Removes the specified key(s) and their corresponding values from the local storage.\n\n- `has(key: string): boolean`: Checks if a key is present in the local storage.\n\n#### Examples\n\n```ts\nconst lStorage = new LocalStorage(\"StorageKey\");\n\n// Getting a value\nconst value = lStorage.getValue(\"my-key\", defaultValueIfExist);\n\n// Setting a value\nlStorage.setValue(\"my-key\", {\"key\":\"value\"});\n\n// Setting multiple values\nlStorage.setValues({ \"my-key1\": \"my-value\", \"my-key2\": {key:\"value\"}});\n\n// Removing values\nlStorage.removeValues([\"key1\", \"key2\", \"key3\"]);\n\n// Checking if a key exists\nconst hasName = lStorage.has(\"name\");\n```\n\n### Features\n- Unique Key Management: The LocalStorage library creates localstorage within its own object. This eliminates the potential for key conflicts with other scripts or sites that use the same keys, especially during local development.\n- Server Side Rendering (SSR) Compatible: Can be run on the server side without throwing any errors.\n- Bulk Removal: The `removeValues` method allows removing multiple key-value pairs from the local storage at once.\n- Bulk Addition: The `setValues` method enables setting multiple key-value pairs to the local storage simultaneously.\n- Key Checking: The `has` method allows users to check if a specific key exists in the local storage.\n- Usability: The interface and methods of the LocalStorage library are straightforward and intuitive, making it easy even for beginners.\n- Comprehensive Documentation: The library is thoroughly documented, providing clear instructions on how to use each method.\n- Default Value: The `getValue` method allows passing a default value in case a the key does not exist in storage \n","readmeFilename":"README.md","description":"A highly efficient and user-friendly wrapper library for the browser's LocalStorage API. This robust tool abstracts away the intricacies of dealing with client-side storage, offering an intuitive way to manage data persistence in a user's browser."}