{"id":16908975,"url":"https://github.com/doasync/redux-iterate","last_synced_at":"2026-05-11T04:50:51.982Z","repository":{"id":86295927,"uuid":"114680943","full_name":"doasync/redux-iterate","owner":"doasync","description":"Iterator middleware for Redux","archived":false,"fork":false,"pushed_at":"2017-12-18T21:47:51.000Z","size":8,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-11T14:37:26.971Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/doasync.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":"2017-12-18T19:43:10.000Z","updated_at":"2018-05-19T23:54:48.000Z","dependencies_parsed_at":"2023-03-13T09:33:50.819Z","dependency_job_id":null,"html_url":"https://github.com/doasync/redux-iterate","commit_stats":{"total_commits":8,"total_committers":1,"mean_commits":8.0,"dds":0.0,"last_synced_commit":"c9a619cf8e6037dd2bba6211f07b811dd7aebbe9"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doasync%2Fredux-iterate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doasync%2Fredux-iterate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doasync%2Fredux-iterate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doasync%2Fredux-iterate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/doasync","download_url":"https://codeload.github.com/doasync/redux-iterate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244665680,"owners_count":20490275,"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-13T18:53:45.371Z","updated_at":"2026-05-11T04:50:46.931Z","avatar_url":"https://github.com/doasync.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Redux iterator middleware\n\nUse (async) generators as action creators to yield actions. This middleware will handle dispatched iterators ('nextable' objects).\n\n[![NPM Version][npm-image]][npm-url] ![NPM Downloads][downloads-image] [![GitHub issues][issues-image]][issues-url] [![Licence][license-image]][license-url]\n\n[npm-image]: https://img.shields.io/npm/v/redux-iterate.svg\n[npm-url]: https://www.npmjs.com/package/redux-iterate.svg\n[downloads-image]: https://img.shields.io/npm/dw/redux-iterate.svg\n[deps-image]: https://david-dm.org/doasync/redux-iterate.svg\n[issues-image]: https://img.shields.io/github/issues/doasync/redux-iterate.svg\n[issues-url]: https://github.com/doasync/redux-iterate/issues\n[license-image]: https://img.shields.io/badge/license-MIT-blue.svg\n[license-url]: https://raw.githubusercontent.com/doasync/redux-iterate/master/LICENSE\n\n## Installation\n\n```bash\nnpm install --save redux-iterate\n```\n\nThen, to enable Iterator Middleware, use applyMiddleware():\n\n```javascript\nimport { createStore, applyMiddleware } from 'redux';\nimport iterate from 'redux-iterate';\nimport rootReducer from './reducers';\n\n// Note: this API requires redux@\u003e=3.1.0\nconst store = createStore(\n  rootReducer,\n  applyMiddleware(iterate)\n);\n```\n\n## Usage\n\nYou can use generators as action creators with this middleware enabled.\n\nYield action objects to dispatch them! Forget about wrapping each time with `dispatch`:\n\n```javascript\n// Action creator\nexport const signIn = async function* (payload) {\n  const { username, password } = payload;\n  let state = yield; // won't be dispatched, just returns current state\n  yield signInStart();\n  try {\n    const response = await axios.post(API_SIGN_IN, { username, password });\n    yield signInEnd();\n    yield signInSuccess(response.data);\n    return username;\n  } catch (error) {\n    yield signInEnd();\n    yield signInError(error);\n  }\n};\n```\n\n`yield` always returns a new state. If you yield nothing (undefined), it just returns current state (nothing happens):\n\n```javascript\n// Inside generator\nconst params = getDataFromState(yield); // yield expression\n```\n\nTo invoke your action creator/generator directly wrap it into a dispatch call using `connect` from `react-redux` or `bindActionCreators` from `redux`.\n\nIf you want to do something when your binded action is done, `return` some data from generator and get it with .then:\n\n```javascript\nsignIn().then(username =\u003e {\n  console.log(username)\n});\n```\n\nYep, nice) Tell your friend.\n\n## Author\n\n@doasync\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoasync%2Fredux-iterate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoasync%2Fredux-iterate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoasync%2Fredux-iterate/lists"}