{"_id":"@artizon/derive-zustand","_rev":"2-53eb91291df0f0edbd30f9e3e6a8b04c","name":"@artizon/derive-zustand","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@artizon/derive-zustand","version":"1.0.0","description":"","private":false,"publishConfig":{"access":"public"},"main":"./dist/derive-zustand.js","module":"./dist/derive-zustand.mjs","exports":{".":{"import":"./dist/derive-zustand.js","require":"./dist/derive-zustand.mjs"}},"types":"./dist/main.d.ts","keywords":["zustand","derive-zustand"],"author":{"name":"artizon"},"license":"MIT","devDependencies":{"vite":"^4.5.0","vite-plugin-dts":"^3.6.2","vite-plugin-externalize-deps":"^0.7.0","vitest":"^0.34.6","immer":"^10.0.3","zustand":"^4.4.4"},"peerDependencies":{"immer":"^10.0.3","zustand":"^4.4.4"},"scripts":{"build":"vite build","test":"vitest --config ./vite.config.ts"},"gitHead":"b798d5bf03650aa0f37be0b467e6f8b5119eb0cd","_id":"@artizon/derive-zustand@1.0.0","_integrity":"sha512-tauEF/bl6rAMevW3jx1G6+ufnE1dyMTTCvvzjaP4VBwz+oJqQfO0sjXU2SaRSActrCQamRFtZW8iWEhr/FAM6w==","_resolved":"/tmp/nix-shell.DYSXNH/e64c34e4cea70cd7465ae1aeb01863b0/artizon-derive-zustand-1.0.0.tgz","_from":"file:artizon-derive-zustand-1.0.0.tgz","_nodeVersion":"20.5.1","_npmVersion":"9.8.0","dist":{"integrity":"sha512-tauEF/bl6rAMevW3jx1G6+ufnE1dyMTTCvvzjaP4VBwz+oJqQfO0sjXU2SaRSActrCQamRFtZW8iWEhr/FAM6w==","shasum":"137be5d232b7e9e9387bbbb8e2d49fd540d131a2","tarball":"https://registry.npmjs.org/@artizon/derive-zustand/-/derive-zustand-1.0.0.tgz","fileCount":10,"unpackedSize":17514,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCohV2gqTyOjridjO5Y6t9fTmNZ/MkjsMC6deMnxi556QIhAJKgzVzabBKDfu2mT/SK/kb8J1dzGvq0bC1tPUGTKXTY"}]},"_npmUser":{"name":"artizon","email":"mingsum.sam@gmail.com"},"directories":{},"maintainers":[{"name":"artizon","email":"mingsum.sam@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/derive-zustand_1.0.0_1698394725916_0.19968485984750028"},"_hasShrinkwrap":false},"1.0.1":{"name":"@artizon/derive-zustand","version":"1.0.1","description":"Example usage: ```ts","private":false,"publishConfig":{"access":"public"},"main":"./dist/derive-zustand.js","module":"./dist/derive-zustand.mjs","types":"./dist/main.d.ts","scripts":{"build":"vite build","test":"vitest --config ./vite.config.ts"},"keywords":["zustand","derive-zustand"],"author":{"name":"artizon"},"license":"MIT","devDependencies":{"vite":"^4.5.0","vite-plugin-dts":"^3.6.2","vite-plugin-externalize-deps":"^0.7.0","vitest":"^0.34.6","immer":"^10.0.3","zustand":"^4.4.4"},"peerDependencies":{"immer":"^10.0.3","zustand":"^4.4.4"},"_id":"@artizon/derive-zustand@1.0.1","gitHead":"243279cddd7cb1a12dab13595314711fe4e0e01d","_nodeVersion":"20.5.1","_npmVersion":"9.8.0","dist":{"integrity":"sha512-stSDYy3XddNJHulMlSbA5nj2fK9+EeIonpCvW45P0s0TGPiMp/zJ9LXMWpQhA3izVCf59fYU5fMESohIfYFNfw==","shasum":"b9a37d3dc8a40236f6aa5bc8b7d09c394dbff19f","tarball":"https://registry.npmjs.org/@artizon/derive-zustand/-/derive-zustand-1.0.1.tgz","fileCount":9,"unpackedSize":16491,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBz/T7037q/0bYi8CZwlVdu/GpZhhZCylBpeLjIRs0WgAiBIAM3F5QBEsFaFfZR0vp8hZj12zMnK783OaxLUyX0okA=="}]},"_npmUser":{"name":"artizon","email":"mingsum.sam@gmail.com"},"directories":{},"maintainers":[{"name":"artizon","email":"mingsum.sam@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/derive-zustand_1.0.1_1698395036592_0.29934088957334026"},"_hasShrinkwrap":false},"1.0.2":{"name":"@artizon/derive-zustand","version":"1.0.2","description":"A function to create a derived Zustand store from many input stores.","private":false,"publishConfig":{"access":"public"},"main":"./dist/derive-zustand.js","module":"./dist/derive-zustand.mjs","types":"./dist/main.d.ts","scripts":{"build":"vite build","test":"vitest --config ./vite.config.ts"},"keywords":["zustand","derive-zustand"],"author":{"name":"artizon"},"license":"MIT","devDependencies":{"vite":"^4.5.0","vite-plugin-dts":"^3.6.2","vite-plugin-externalize-deps":"^0.7.0","vitest":"^0.34.6","immer":"^10.0.3","zustand":"^4.4.4"},"peerDependencies":{"immer":"^10.0.3","zustand":"^4.4.4"},"_id":"@artizon/derive-zustand@1.0.2","gitHead":"35570ba4da1a8b9945221f6e99e8a29cae162f7e","_nodeVersion":"20.5.1","_npmVersion":"9.8.0","dist":{"integrity":"sha512-5bz+tPlj0aKc9OE+HIjp+c3zpYkE7+J+n8EGc93Yibwm9TAuhEn8vngn4576OpCISKbPLH7ZR3six8c8DSYMRg==","shasum":"f03b5fb8866dc3700f8ff964d5df62dcca10c60d","tarball":"https://registry.npmjs.org/@artizon/derive-zustand/-/derive-zustand-1.0.2.tgz","fileCount":9,"unpackedSize":17165,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAbAfvuWKPkdLyukLeovBBvdoLCqM23Y+iXl7u1dKUDyAiEAiag3m4A563g+/2jo7YcKNVCrxb/o7or5BQtD+aVKUpg="}]},"_npmUser":{"name":"artizon","email":"mingsum.sam@gmail.com"},"directories":{},"maintainers":[{"name":"artizon","email":"mingsum.sam@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/derive-zustand_1.0.2_1698395808979_0.0031738938114240778"},"_hasShrinkwrap":false}},"time":{"created":"2023-10-27T08:18:45.826Z","1.0.0":"2023-10-27T08:18:46.143Z","modified":"2023-10-27T08:36:49.343Z","1.0.1":"2023-10-27T08:23:56.773Z","1.0.2":"2023-10-27T08:36:49.178Z"},"maintainers":[{"name":"artizon","email":"mingsum.sam@gmail.com"}],"keywords":["zustand","derive-zustand"],"author":{"name":"artizon"},"license":"MIT","readme":"# `derive-zustand`\n\nA function to create a derived Zustand store from many input stores.\n\n**Comparision with [dai-shi/derive-zustand](https://github.com/dai-shi/derive-zustand)**:\n\nThis `derive-zustand`'s `deriveFn` (`onChange`) takes two additional arguments:\n- Previous states of the dependant stores\n- Previous state of the derived store itself\n\nExample usage:\n\n```typescript\nconst depStore1 = create<{\n  value: number[];\n}>(() => ({\n  value: [1],\n}));\n\nconst depStore2 = create<{\n  value: number[];\n}>(() => ({\n  value: [2],\n}));\n\nconst deriveStore = derive<string, [typeof depStore1, typeof depStore2]>(\n  [depStore1, depStore2],\n  ([dep1, dep2], prevDeps, prevState) => {\n    return `${dep1} ${dep2}`;\n  }\n);\n```\n","readmeFilename":"README.md","description":"A function to create a derived Zustand store from many input stores."}