{"_id":"@nanostores/deepmap","_rev":"5-3f51676dfc67c18b756a7fc416cc99f6","name":"@nanostores/deepmap","dist-tags":{"latest":"1.0.0"},"versions":{"0.0.1":{"name":"@nanostores/deepmap","version":"0.0.1","keywords":["store","state","nanostores","deepmap","state manager","react","react native","preact","vue","svelte"],"author":{"name":"Edgar Sanchez","email":"albertolifo@gmail.com"},"license":"MIT","_id":"@nanostores/deepmap@0.0.1","maintainers":[{"name":"wobsoriano","email":"sorianorobertc@gmail.com"},{"name":"ai","email":"andrey@sitnik.ru"},{"name":"dkzlv","email":"d.kzlv.ru@gmail.com"},{"name":"ninoid","email":"ninatorgunakova@gmail.com"},{"name":"lifo123","email":"alberto_p-@hotmail.com"}],"homepage":"https://github.com/nanostores/deep-map#readme","bugs":{"url":"https://github.com/nanostores/deep-map/issues"},"dist":{"shasum":"e71555ddde7d1d9ef7b2f51812aca655f05c6f70","tarball":"https://registry.npmjs.org/@nanostores/deepmap/-/deepmap-0.0.1.tgz","fileCount":13,"integrity":"sha512-Wp7elfx/naWM61XOzC+qZOYQ565VVtUAU7NQSgjORRVSKn57U31GYHpn3TKImW7Vdfa9TAykIjzB7JVjH2L4fw==","signatures":[{"sig":"MEQCIFyqu5KvAhxgIZ0fkhtMay505L4qTuCurNS/IXUbQ7C1AiB2poBJ48r179rjOXxFcUOK0cfTj14FMeB+aGiuuuV0Vg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":17693},"main":"./dist/index.js","type":"module","_from":"file:nanostores-deepmap-0.0.1.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":"^20.0.0 || >=22.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"tsx watch deep-map/deepmap.test.ts","test":"pnpm run /^test:/","build":"tsc","test:lint":"eslint .","test:types":"check-dts","test:coverage":"vitest run --coverage"},"_npmUser":{"name":"lifo123","email":"alberto_p-@hotmail.com"},"_resolved":"C:\\Users\\liftb\\AppData\\Local\\Temp\\fb51b4fa046153d29aa0e838e30cad5e\\nanostores-deepmap-0.0.1.tgz","_integrity":"sha512-Wp7elfx/naWM61XOzC+qZOYQ565VVtUAU7NQSgjORRVSKn57U31GYHpn3TKImW7Vdfa9TAykIjzB7JVjH2L4fw==","repository":{"url":"git+https://github.com/nanostores/deep-map.git","type":"git"},"_npmVersion":"10.9.1","description":"A helper for Nanostores to create deep maps","directories":{},"sideEffects":false,"_nodeVersion":"24.11.1","_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.20.6","jiti":"^2.6.1","eslint":"^9.39.1","vitest":"^4.0.9","check-dts":"^0.9.0","@eslint/js":"^9.39.1","typescript":"^5.9.3","typescript-eslint":"^8.46.4","@vitest/coverage-v8":"^4.0.9"},"peerDependencies":{"nanostores":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/deepmap_0.0.1_1763337281285_0.17659221897229016","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"@nanostores/deepmap","version":"0.0.2","keywords":["store","state","nanostores","deepmap","state manager","react","react native","preact","vue","svelte"],"author":{"name":"Edgar Sanchez","email":"albertolifo@gmail.com"},"license":"MIT","_id":"@nanostores/deepmap@0.0.2","maintainers":[{"name":"lifo123","email":"alberto_p-@hotmail.com"}],"homepage":"https://github.com/nanostores/deepmap#readme","bugs":{"url":"https://github.com/nanostores/deepmap/issues"},"dist":{"shasum":"eac06eea6d331084ee881bfaab82e88e11e974a8","tarball":"https://registry.npmjs.org/@nanostores/deepmap/-/deepmap-0.0.2.tgz","fileCount":13,"integrity":"sha512-DxElMRKauvxXWlzoCZ/IjdQlXO03XDY1qnFB100/3xlcZ+KX7r78fHs1w9qU/+pph6lkQ9BgiuTr+BR6qxZ5CA==","signatures":[{"sig":"MEQCIEkJ3ejxihjQmzFFCPD3FdPSYYr9BJWZu/JEcKL08+qYAiBS40ncFmCFsq9HJZeX6K3v6e9ikrjbrTlnb5xya/H6XA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":16558},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":"^20.0.0 || >=22.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"ae8f8a3fd5ea4a0306c11c57d50e6e0606eac4f6","scripts":{"dev":"tsx watch deep-map/deepmap.test.ts","test":"pnpm run /^test:/","build":"tsc","test:lint":"eslint .","test:types":"check-dts","test:coverage":"vitest run --coverage"},"_npmUser":{"name":"lifo123","email":"alberto_p-@hotmail.com"},"repository":{"url":"git+https://github.com/nanostores/deepmap.git","type":"git"},"_npmVersion":"10.9.1","description":"A helper for Nanostores to create deep maps","directories":{},"sideEffects":false,"_nodeVersion":"20.11.1","_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.20.6","jiti":"^2.6.1","eslint":"^9.39.1","vitest":"^4.0.9","check-dts":"^0.9.0","@eslint/js":"^9.39.1","typescript":"^5.9.3","typescript-eslint":"^8.46.4","@vitest/coverage-v8":"^4.0.9"},"peerDependencies":{"nanostores":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/deepmap_0.0.2_1778184822832_0.46208775031002625","host":"s3://npm-registry-packages-npm-production"}},"1.0.0":{"name":"@nanostores/deepmap","version":"1.0.0","description":"A helper for Nanostores to create deep maps","keywords":["store","state","nanostores","deepmap","state manager","react","react native","preact","vue","svelte"],"scripts":{"build":"tsc","dev":"tsx watch deep-map/deepmap.test.ts","test:lint":"eslint .","test:types":"check-dts","test:coverage":"vitest run --coverage","test":"pnpm run /^test:/"},"author":{"name":"Edgar Sanchez","email":"albertolifo@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/nanostores/deepmap.git"},"sideEffects":false,"type":"module","main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/index.js","types":"./dist/index.d.ts"}},"engines":{"node":"^20.0.0 || >=22.0.0"},"peerDependencies":{"nanostores":"^1.4.0"},"devDependencies":{"@eslint/js":"^9.39.1","@vitest/coverage-v8":"^4.0.9","check-dts":"^0.9.0","eslint":"^9.39.1","jiti":"^2.6.1","tsx":"^4.20.6","typescript":"^5.9.3","typescript-eslint":"^8.46.4","vitest":"^4.0.9"},"_id":"@nanostores/deepmap@1.0.0","gitHead":"b03cb4ec78efecc9ecb4680b2943cf0433b15d9b","bugs":{"url":"https://github.com/nanostores/deepmap/issues"},"homepage":"https://github.com/nanostores/deepmap#readme","_nodeVersion":"22.22.3","_npmVersion":"10.9.8","dist":{"integrity":"sha512-OFDeehXHwDKolaLrqTFoIYQgjQ0vNBt2dxaArqeRjuQL8uO3yujf+YdxrD6r6aWkMpgEjzo3ayDkaaHj5iFL0Q==","shasum":"dc111124eb4bcd38a6a0481e7332a6a09ff1b3fb","tarball":"https://registry.npmjs.org/@nanostores/deepmap/-/deepmap-1.0.0.tgz","fileCount":13,"unpackedSize":17726,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCK/VEy/kExNuBBk2EU/yaBaIezDVGJEpduYRboJ8vOlgIgdbnTKqy1ER8YkOEG1WXyLw9PqdpNL+2qVJaiZbBPyJI="}]},"_npmUser":{"name":"lifo123","email":"alberto_p-@hotmail.com"},"directories":{},"maintainers":[{"name":"lifo123","email":"alberto_p-@hotmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/deepmap_1.0.0_1782591170747_0.4794748054403106"},"_hasShrinkwrap":false}},"time":{"created":"2025-11-16T23:54:41.219Z","modified":"2026-06-27T20:12:51.106Z","0.0.1":"2025-11-16T23:54:41.471Z","0.0.2":"2026-05-07T20:13:42.973Z","1.0.0":"2026-06-27T20:12:50.871Z"},"bugs":{"url":"https://github.com/nanostores/deepmap/issues"},"author":{"name":"Edgar Sanchez","email":"albertolifo@gmail.com"},"license":"MIT","homepage":"https://github.com/nanostores/deepmap#readme","keywords":["store","state","nanostores","deepmap","state manager","react","react native","preact","vue","svelte"],"repository":{"type":"git","url":"git+https://github.com/nanostores/deepmap.git"},"description":"A helper for Nanostores to create deep maps","maintainers":[{"name":"lifo123","email":"alberto_p-@hotmail.com"}],"readme":"# Nano Stores DeepMap\n\n<img align=\"right\" width=\"64\" height=\"64\" title=\"Nano Stores logo\"\nsrc=\"https://nanostores.github.io/nanostores/logo.svg\">\n\nDeep maps extension for [Nano Stores](https://github.com/nanostores/nanostores) state manager. It provides a store to put big nested objects or arrays and change keys by path with fine-grained reactivity.\n\n## Install\n\n```sh\nnpm install @nanostores/deepmap\n```\n\n## Usage\n\nImport `deepMap` from this package to initialize a store with a deeply nested object or array.\n\n```ts\nimport { deepMap } from '@nanostores/deepmap'\n\ntype StoreType = {\n  user?: {\n    name: string\n    age: number\n  }\n  count?: number\n  items?: { id: string }[]\n}\n\nconst $store = deepMap<StoreType>({\n  user: {\n    name: 'Luke',\n    age: 19,\n  },\n  count: 0,\n})\n```\n### Path Syntax\n\n`deepMap` provides various methods to interact with your nested state easily without mutating the original object. It supports two path syntaxes:\n- **`key.subkey`:** To access a deeply nested property in a object.\n- `key[0]`: To access an item in an array by index.\n\n### GetKey\n\nUse `getKey` to obtain the current value at a specific path.\n\n```ts\n$store.getKey('user.name')\n// -> \"Luke\"\n```\n\n### SetKey\n\nUse `setKey` to create or replace any value at a specific path.\n\n```ts\n// Replaces the value at 'count'\n$store.setKey('count', 1)\n\n// Note: undefined value is reserved for deletion\n```\n\n### UpdateKey and Update\n\nUse `updateKey` to merge new data into an existing object or to concatenate items into an array. If the target isn't an object or array, it will simply be replaced. Use `update` to modify the root state object.\n```ts\n$store.updateKey('user.age', 42)\n// -> { user: { name: 'Luke', age: 42 }, ... }\n\n// Pushes/concatenates new items to an array\n// Note: You need to use the [] syntax to update an array\n$store.updateKey('items', [{ id: 'uuid-2' }])\n// -> { items: [{ id: 'uuid-1' }, { id: 'uuid-2' }] }\n```\n\n### DeleteKey\n\nUse `deleteKey` to remove a property from an object. You can also use `setKey` with an `undefined` value.\n\n```ts\n// Deletes 'count' from the store\n$store.deleteKey('count')\n$store.setKey('count', undefined)\n```\n\n## TypeScript Support\n\nThe package is written in TypeScript and provides autocomplete for all methods and properties, even the nested ones.\n\n```ts\ntype UserType = {\n  id?: string\n  settings?: { theme: string }\n}\n\nconst $user = deepMap<UserType>({})\n\n// Autocomplete will suggest 'id' and 'settings.theme'\n$user.setKey('settings.theme', 'dark')\n```\n\nTypescript automatically infers and validates the type of the value at the specified path:\n\n```ts\n$store.setKey('count', 'randomString')\n// Type Error -> 'string' is not assignable to type 'number'\n```\n\n## Integrations\n\n### React & Preact\n\nWhen using a hook `useStore` you can pass an array of keys for listening to changes.\n\n```tsx\n// Reactivity in user branch, any child mutation fire a re-render\nconst { name } = useStore($store, { keys: ['user']})\n\n// Specific reactivity\n\nconst { name } = useStore($store, { keys: ['user.name']}) // Only listen the exact key path\n```\n\nIf your component only depends on a specific nested value, listen to the exact path. This prevents unnecessary re-renders when sibling properties change.\n\n## License\n\nMIT\n\n## Credits\n\n* [Dan Kozlov](https://github.com/dkzlv) the author of `deepmap()` in [Nano stores](https://github.com/nanostores/nanostores) core.\n","readmeFilename":"README.md"}