{"_id":"@boombox/storage","_rev":"3-44c9735c3637677d2d3a05416ae012d9","name":"@boombox/storage","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.0":{"name":"@boombox/storage","version":"1.0.0","description":"A simple localStorage and sessionStorage wrapper to support your set/get object or array data directly.","type":"module","main":"lib/index.js","exports":"./lib/index.js","types":"lib/index.d.ts","scripts":{"test":"jest --config jestconfig.json","build":"tsc","format":"prettier --write \"src/**/*.ts\" \"src/**/*.js\"","lint":"eslint 'src/**/*.{js,ts}'","prepare":"npm run build","prepublishOnly":"npm test && npm run lint","preversion":"npm run lint","version":"npm run format && git add -A src","postversion":"git push && git push --tags"},"repository":{"type":"git","url":"git+https://github.com/Penggeor/boombox.git"},"keywords":["localStorage","sessionStorage"],"author":{"name":"penggeor"},"license":"ISC","bugs":{"url":"https://github.com/Penggeor/boombox/issues"},"homepage":"https://github.com/Penggeor/boombox#readme","devDependencies":{"@jest/globals":"^29.7.0","@types/jest":"^29.5.12","@types/jsdom":"^21.1.6","@typescript-eslint/eslint-plugin":"^7.1.1","@typescript-eslint/parser":"^7.1.1","eslint":"^8.57.0","jest":"^29.7.0","jest-environment-jsdom":"^29.7.0","jsdom":"^24.0.0","prettier":"^3.2.5","ts-jest":"^29.1.2","typescript":"^5.3.3"},"_id":"@boombox/storage@1.0.0","gitHead":"ba50ceab739b1c032238e1e215504dee27ecfc9e","_nodeVersion":"20.11.1","_npmVersion":"10.2.4","dist":{"integrity":"sha512-wmxGvydxg1WJU+Bt3CLUkBYxcnc0CsXpRdVbvTuiVKObbzfXwOBVrHzcS9oG3Tsm8LS6JNRB3OgyABbevSsYSw==","shasum":"3644637a380574a45d06f13b57403331ceae0ef2","tarball":"https://registry.npmjs.org/@boombox/storage/-/storage-1.0.0.tgz","fileCount":4,"unpackedSize":8523,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIE/zCMjznznrfrLPKftVMceFLKIy31oP6BZtXisZS1QPAiBuCGJWXI6D87hQ5mkvzxi8pNMNM2rSPbryF13Jlr4NDw=="}]},"_npmUser":{"name":"penggeor","email":"wkpcoder@163.com"},"directories":{},"maintainers":[{"name":"penggeor","email":"wkpcoder@163.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/storage_1.0.0_1709965189722_0.18696233535838203"},"_hasShrinkwrap":false},"1.0.1":{"name":"@boombox/storage","version":"1.0.1","description":"A simple localStorage and sessionStorage wrapper to support your set/get object or array data directly.","type":"module","main":"lib/index.js","exports":"./lib/index.js","types":"lib/index.d.ts","scripts":{"test":"jest --config jestconfig.json","build":"tsc","format":"prettier --write \"src/**/*.ts\" \"src/**/*.js\"","lint":"eslint 'src/**/*.{js,ts}'","prepare":"npm run build","prepublishOnly":"npm test && npm run lint","preversion":"npm run lint","version":"npm run format && git add -A src","postversion":"git push && git push --tags"},"repository":{"type":"git","url":"git+https://github.com/Penggeor/boombox.git#main"},"keywords":["localStorage","sessionStorage"],"author":{"name":"penggeor"},"license":"ISC","bugs":{"url":"https://github.com/Penggeor/boombox/issues"},"homepage":"https://github.com/Penggeor/boombox#readme","devDependencies":{"@jest/globals":"^29.7.0","@types/jest":"^29.5.12","@types/jsdom":"^21.1.6","@typescript-eslint/eslint-plugin":"^7.1.1","@typescript-eslint/parser":"^7.1.1","eslint":"^8.57.0","jest":"^29.7.0","jest-environment-jsdom":"^29.7.0","jsdom":"^24.0.0","prettier":"^3.2.5","ts-jest":"^29.1.2","typescript":"^5.3.3"},"_id":"@boombox/storage@1.0.1","gitHead":"54fd01ba0ae2fedf04cf031b9bddd40fec161e24","_nodeVersion":"20.11.1","_npmVersion":"10.2.4","dist":{"integrity":"sha512-vBaT9n5NwCaOSEO5dMQnN5z4Wk5xpSDby8ZkC6pyayEvDx64tFhM2BHoKMkte4+CS06Ebit8x+vI0fOsNXZ2Pw==","shasum":"0ee73666c04c8e0a3df3a1adba702c29c0bb1c6d","tarball":"https://registry.npmjs.org/@boombox/storage/-/storage-1.0.1.tgz","fileCount":4,"unpackedSize":5121,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCzTsXKE4MYRRIfZtidxVz9zfflLy9UbpLqMDpubm+q+QIgWeCBUUynUx0lIX9yr+vHbWHgAFEik7s4SFpw4GkLP8w="}]},"_npmUser":{"name":"penggeor","email":"wkpcoder@163.com"},"directories":{},"maintainers":[{"name":"penggeor","email":"wkpcoder@163.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/storage_1.0.1_1710861343344_0.7760008577788955"},"_hasShrinkwrap":false},"1.0.2":{"name":"@boombox/storage","version":"1.0.2","description":"A simple localStorage and sessionStorage wrapper to support your set/get object or array data directly.","type":"module","main":"lib/index.js","exports":"./lib/index.js","types":"lib/index.d.ts","scripts":{"test":"jest --config jestconfig.json","build":"tsc","format":"prettier --write \"src/**/*.ts\" \"src/**/*.js\"","lint":"eslint 'src/**/*.{js,ts}'","prepare":"npm run build","prepublishOnly":"npm test && npm run lint","preversion":"npm run lint","version":"npm run format && git add -A src","postversion":"git push && git push --tags"},"repository":{"type":"git","url":"git+https://github.com/Penggeor/boombox.git#main"},"keywords":["localStorage","sessionStorage"],"author":{"name":"penggeor"},"license":"ISC","bugs":{"url":"https://github.com/Penggeor/boombox/issues"},"homepage":"https://github.com/Penggeor/boombox#readme","devDependencies":{"@jest/globals":"^29.7.0","@types/jest":"^29.5.12","@types/jsdom":"^21.1.6","@typescript-eslint/eslint-plugin":"^7.1.1","@typescript-eslint/parser":"^7.1.1","eslint":"^8.57.0","jest":"^29.7.0","jest-environment-jsdom":"^29.7.0","jsdom":"^24.0.0","prettier":"^3.2.5","ts-jest":"^29.1.2","typescript":"^5.3.3"},"_id":"@boombox/storage@1.0.2","gitHead":"54fd01ba0ae2fedf04cf031b9bddd40fec161e24","_nodeVersion":"20.11.1","_npmVersion":"10.2.4","dist":{"integrity":"sha512-Xz0zAeSTvcg0CTk75BrK3eV7O2g2STYESvj2REwI0FDGVdpMfQU5U1ySMGQ9PKjhziTUriJMHENQsZNw4TrY/Q==","shasum":"b102da2dbafc20b027c1d2233a18b1aedd214052","tarball":"https://registry.npmjs.org/@boombox/storage/-/storage-1.0.2.tgz","fileCount":4,"unpackedSize":5186,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICAhUm3x/nbPT6rguy0l02J24eDSY0Q2gP+0qzYazdewAiEAzKAfzBVqAHHL33wMLUsjSBiQ5aB8jgMAwNt3xHygvlc="}]},"_npmUser":{"name":"penggeor","email":"wkpcoder@163.com"},"directories":{},"maintainers":[{"name":"penggeor","email":"wkpcoder@163.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/storage_1.0.2_1710861521149_0.5208204701453734"},"_hasShrinkwrap":false},"1.1.0":{"name":"@boombox/storage","version":"1.1.0","description":"A simple localStorage and sessionStorage wrapper to support your set/get object or array data directly.","type":"module","main":"lib/index.js","exports":"./lib/index.js","types":"lib/index.d.ts","scripts":{"test":"jest --config jestconfig.json","build":"tsc","format":"prettier --write \"src/**/*.ts\" \"src/**/*.js\"","lint":"eslint 'src/**/*.{js,ts}'","prepare":"npm run build","prepublishOnly":"npm test && npm run lint","preversion":"npm run lint","version":"npm run format && git add -A src","postversion":"git push && git push --tags"},"repository":{"type":"git","url":"git+https://github.com/Penggeor/boombox.git#main"},"keywords":["localStorage","sessionStorage"],"author":{"name":"penggeor"},"license":"ISC","bugs":{"url":"https://github.com/Penggeor/boombox/issues"},"homepage":"https://github.com/Penggeor/boombox#readme","devDependencies":{"@jest/globals":"^29.7.0","@types/jest":"^29.5.12","@types/jsdom":"^21.1.6","@typescript-eslint/eslint-plugin":"^7.1.1","@typescript-eslint/parser":"^7.1.1","eslint":"^8.57.0","jest":"^29.7.0","jest-environment-jsdom":"^29.7.0","jsdom":"^24.0.0","prettier":"^3.2.5","ts-jest":"^29.1.2","typescript":"^5.3.3"},"_id":"@boombox/storage@1.1.0","gitHead":"54fd01ba0ae2fedf04cf031b9bddd40fec161e24","_nodeVersion":"20.11.1","_npmVersion":"10.2.4","dist":{"integrity":"sha512-n1Gbr2LS0pRZ9xuI6oIGyp/yuyk11MVHGzh56ZGeDhCE2GmXETZREdPX/BOedJTiXCooMDjeQqaAxj6cIRvIvg==","shasum":"f3b675f564d4f0d382234536f332737d3bfed52d","tarball":"https://registry.npmjs.org/@boombox/storage/-/storage-1.1.0.tgz","fileCount":4,"unpackedSize":5618,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCE78LgHnvMhrbf62CVCxLplhqouqoFJ3QGM/g/42x+iAIgaToG2UiW/9tzPjZOQOVc0WA1lfEN4Ky+WPyskDA+T1Q="}]},"_npmUser":{"name":"penggeor","email":"wkpcoder@163.com"},"directories":{},"maintainers":[{"name":"penggeor","email":"wkpcoder@163.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/storage_1.1.0_1710937115343_0.7762981298290017"},"_hasShrinkwrap":false}},"time":{"created":"2024-03-09T06:19:49.619Z","1.0.0":"2024-03-09T06:19:49.914Z","modified":"2024-03-20T12:18:36.069Z","1.0.1":"2024-03-19T15:15:43.537Z","1.0.2":"2024-03-19T15:18:41.311Z","1.1.0":"2024-03-20T12:18:35.567Z"},"maintainers":[{"name":"penggeor","email":"wkpcoder@163.com"}],"description":"A simple localStorage and sessionStorage wrapper to support your set/get object or array data directly.","homepage":"https://github.com/Penggeor/boombox#readme","keywords":["localStorage","sessionStorage"],"repository":{"type":"git","url":"git+https://github.com/Penggeor/boombox.git#main"},"author":{"name":"penggeor"},"bugs":{"url":"https://github.com/Penggeor/boombox/issues"},"license":"ISC","readme":"# `localStorage`/`sessionStorage` 轻量封装\n\n`localStorage` 只能设置字符串，需要设置对象时比较麻烦。\n\n该包提供了一个简单的封装，可以**直接获取、存储对象**。\n\n```typescript\n// 导入 localStorage\nimport { localStorage } from '@boombox/storage';\n```\n\n```typescript\n// 像正常的 localStorage 一样使用\n// 1. 获取 item\nconst storage = localStorage.getItem('statistic')\n// 2. 设置 item\nlocalStorage.setItem('statistic', storage)\n```\n\n```typescript\n// 直接存储\nlocalStorage.setItem('statistic', { count: 1 })\n```\n\n这里实际是用 `serialize` 和 `deserialize` 方法来实现的。\n\n默认 `serialize` 为 `JSON.stringify`，`deserialize` 为 `JSON.parse`。\n\n\n可以设置自定义的 `serialize` 和 `deserialize` 方法。\n\n```typescript\n// 比如 YAML 序列化\nimport { localStorage } from '@boombox/storage';\nimport { safeDump, safeLoad } from 'js-yaml';\n\nlocalStorage.serialize = safeDump;\nlocalStorage.deserialize = safeLoad;\n```\n\n# 案例\n\n- **MulSearch**: https://github.com/Penggeor/mul-search","readmeFilename":"README.md"}