{"id":21358312,"url":"https://github.com/bowheart/zedux-immer","last_synced_at":"2025-07-17T07:06:29.032Z","repository":{"id":91226850,"uuid":"117261291","full_name":"bowheart/zedux-immer","owner":"bowheart","description":"ATTENTION! This is the old repository. The Zedux React package has moved to https://github.com/omnistac/zedux/tree/master/packages/immer","archived":false,"fork":false,"pushed_at":"2023-04-13T23:35:46.000Z","size":60,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-10T21:15:40.372Z","etag":null,"topics":["immer","immutable","redux","state","zedux"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bowheart.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-12T16:07:38.000Z","updated_at":"2023-04-14T00:15:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"8320ed89-283a-4b79-b8cc-3d9cfe5c667a","html_url":"https://github.com/bowheart/zedux-immer","commit_stats":{"total_commits":5,"total_committers":1,"mean_commits":5.0,"dds":0.0,"last_synced_commit":"874dfbb21e71e3cb04e57b55817f76e7d24c5ed8"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/bowheart/zedux-immer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bowheart%2Fzedux-immer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bowheart%2Fzedux-immer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bowheart%2Fzedux-immer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bowheart%2Fzedux-immer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bowheart","download_url":"https://codeload.github.com/bowheart/zedux-immer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bowheart%2Fzedux-immer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261186769,"owners_count":23121943,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["immer","immutable","redux","state","zedux"],"created_at":"2024-11-22T05:15:34.698Z","updated_at":"2025-07-13T00:33:46.396Z","avatar_url":"https://github.com/bowheart.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [DEPRECATED]\n\nThis repo has moved to [`Omnistac/zedux`](https://github.com/omnistac/zedux) - specifically the [`immer` package](https://github.com/omnistac/zedux/tree/master/packages/immer).\n\n# Zedux Immer\n\n[![Build Status](https://travis-ci.org/bowheart/zedux-immer.svg?branch=master)](https://travis-ci.org/bowheart/zedux-immer)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/0459ebf8444c36752eac/test_coverage)](https://codeclimate.com/github/bowheart/zedux-immer/test_coverage)\n[![Maintainability](https://api.codeclimate.com/v1/badges/0459ebf8444c36752eac/maintainability)](https://codeclimate.com/github/bowheart/zedux-immer/maintainability)\n[![npm](https://img.shields.io/npm/v/zedux-immer.svg)](https://www.npmjs.com/package/zedux-immer)\n\nOfficial [Immer](https://github.com/mweststrate/immer) bindings for [Zedux](https://github.com/bowheart/zedux). Because Zedux + Immer = Awesome.\n\nProvides a few simple, standard helper methods for wrapping Zedux reactors in Immer producers.\n\n## Installation\n\nInstall using npm:\n\n```bash\nnpm install --save zedux-immer\n```\n\nOr yarn:\n\n```bash\nyarn add zedux-immer\n```\n\nOr include the appropriate unpkg build on your page:\n\n### Development\n\n```html\n\u003cscript src=\"https://unpkg.com/zedux-immer/dist/zedux-immer.js\"\u003e\u003c/script\u003e\n```\n\n### Production\n\n```html\n\u003cscript src=\"https://unpkg.com/zedux-immer/dist/zedux-immer.min.js\"\u003e\u003c/script\u003e\n```\n\n## Getting started\n\nWell, there's not much to it. The entire documentation is contained in this readme.\n\nTo learn by getting dirty, you can poke around [this codepen](https://codepen.io/bowheart/pen/Gydyor?editors=0010).\n\nTo learn comprehensively, check out the [tests](https://github.com/bowheart/zedux-immer/tree/master/test).\n\n## Method API\n\nZeduxImmer exposes just two functions:\n\n- `immerizeReactor()` \u0026ndash; wraps an existing reactor.\n- `immutablyReact()` \u0026ndash; creates a new, immutable reactor.\n\nLet's look at each of these in more detail:\n\n### `immerizeReactor()`\n\nWraps an existing [reactor](https://bowheart.github.io/zedux/docs/types/Reactor) in an immer [producer](https://github.com/mweststrate/immer#currying).\n\nThis is just a higher-order reactor. Its reducer layer will pass the Immer draft on to the wrapped reactor. Its processor layer is transparent.\n\n#### Examples\n\nAt a high level:\n\n```javascript\nimport { immerizeReactor } from 'zedux-immer'\nimport reactor from './reactor'\n\nconst immerizedReactor = immerizeReactor(reactor)\n```\n\nA not-so-contrived example:\n\n```javascript\nimport { immerizeReactor } from 'zedux-immer'\nimport { act, createStore, react } from 'zedux'\n\n// Create an actor\nconst addTodo = act('addTodo')\n\n// Create a reactor (note the mutation! :O)\nconst todosReactor = react([])\n  .to(addTodo)\n  .withReducers((todos, newTodo) =\u003e todos.push(newTodo))\n\n// Immerize the reactor\nconst immerizedTodosReactor = immerizeReactor(todosReactor)\n\n// Create the store\nconst todosStore = createStore().use(immerizedTodosReactor)\n\n// And have a blast\ntodosStore.dispatch(addTodo('totally rock'))\ntodosStore.dispatch(addTodo('totally rock again'))\n```\n\n### `immutablyReact()`\n\nCreates an immutable [ZeduxReactor](https://bowheart.github.io/zedux/docs/api/ZeduxReactor.html). As such, its api is exactly the same as the ZeduxReactor api.\n\nThis is just a convenience \u0026ndash; With `immerizeReactor()` we have to create the reactor then wrap it in an Immer producer. With `immutablyReact()` we create and wrap the reactor in a single step.\n\n#### Examples\n\nAt a high level:\n\n```javascript\nimport { act } from 'zedux'\nimport { immutablyReact } from 'zedux-immer'\n\n// Create an actor\nconst increment = act('increment')\n\n// Create an immutable reactor\nconst counterReactor = immutablyReact({ counter: 0 })\n  .to(increment)\n  .withReducers(state =\u003e state.counter++) // a mutation \u003e:)\n```\n\nHere's the above `immerizeReactor()` example using `immutablyReact()`\n\n```javascript\nimport { immutablyReact } from 'zedux-immer'\nimport { act, createStore } from 'zedux'\n\n// Create an actor\nconst addTodo = act('addTodo')\n\n// Create an immutable reactor (as always, note the mutation)\nconst todosReactor = immutablyReact([])\n  .to(addTodo)\n  .withReducers((todos, newTodo) =\u003e todos.push(newTodo))\n\n// Create the store\nconst todosStore = createStore().use(immerizedTodosReactor)\n\n// And have a blast\ntodosStore.dispatch(addTodo('totally rock'))\ntodosStore.dispatch(addTodo('totally rock again'))\n```\n\n## Exploring further\n\nCurried Immer producers can be used directly as Zedux [inducers](https://bowheart.github.io/zedux/docs/types/Inducer):\n\n```javascript\nimport produce from 'immer'\nimport { createStore } from 'zedux'\n\n// Create the store and hydrate its initial state\nconst store = createStore().hydrate({ counter: 0 })\n\n// Create some Immerized inducers\nconst increment = produce(state =\u003e state.counter++)\nconst decrement = produce(state =\u003e state.counter--)\n\nstore.dispatch(increment)\nstore.dispatch(increment)\nstore.dispatch(decrement)\n\nstore.getState() // 1\n```\n\n## Contributing\n\nAll contributions are welcome. Just jump right in. Open an issue. PRs, just keep the coding style consistent and the tests at 100% (branches, functions, lines, everything 100%, plz). Be sure to run `npm run lint` and `npm test`. Happy coding!\n\nBugs can be submitted to https://github.com/bowheart/zedux-immer/issues\n\n## License\n\nThe [MIT License](https://github.com/bowheart/zedux-immer/blob/master/LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbowheart%2Fzedux-immer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbowheart%2Fzedux-immer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbowheart%2Fzedux-immer/lists"}