{"id":16331108,"url":"https://github.com/steelydylan/redux-action-handler","last_synced_at":"2025-05-15T16:12:07.571Z","repository":{"id":69412120,"uuid":"143082520","full_name":"steelydylan/redux-action-handler","owner":"steelydylan","description":"handle actions without using switch statements","archived":false,"fork":false,"pushed_at":"2018-09-01T13:58:03.000Z","size":186,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-09T00:02:15.480Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/steelydylan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-08-01T00:10:35.000Z","updated_at":"2018-09-01T13:58:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"80e39338-3baf-4214-a45f-75cbef2bef25","html_url":"https://github.com/steelydylan/redux-action-handler","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steelydylan%2Fredux-action-handler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steelydylan%2Fredux-action-handler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steelydylan%2Fredux-action-handler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steelydylan%2Fredux-action-handler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/steelydylan","download_url":"https://codeload.github.com/steelydylan/redux-action-handler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239286588,"owners_count":19613751,"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":[],"created_at":"2024-10-10T23:25:37.326Z","updated_at":"2025-02-17T12:20:42.975Z","avatar_url":"https://github.com/steelydylan.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# redux-action-handler\n\n## Install\n\n```sh\n$ npm install redux-action-handler --save\n```\n\n## Usage\n\nreducer.js\n```js\nimport * as types from '../constants/ActionTypes';\nimport ActionHandler from 'redux-action-handler';\n\nconst initialState = {\n  count: 0\n};\n\nconst handler = new ActionHandler(initialState);\n\nhandler.addCase(types.INCREMENT, (state, action) =\u003e {\n  return Object.assign({}, state, { count: state.count + 1 });\n});\n\nhandler.addCase(types.DECREMENT, (state, action) =\u003e {\n  return Object.assign({}, state, { count: state.count - 1 });\n});\n\nexport default handler.create();\n```\n\nequivalent to\n\n```js\nimport * as types from '../constants/ActionTypes';\nconst initialState = {\n  count: 0\n};\n\nexport default (state = initialState, actions) =\u003e {\n  switch (actions.type) {\n    case: types.INCREMENT:\n      return Object.assign({}, state, { count: state.count + 1 });\n    case: types.DECREMENT:\n      return Object.assign({}, state, { count: state.count - 1 });\n    default:\n      return state;\n  }\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteelydylan%2Fredux-action-handler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsteelydylan%2Fredux-action-handler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteelydylan%2Fredux-action-handler/lists"}