{"id":17736633,"url":"https://github.com/parro-it/asynciterable","last_synced_at":"2025-03-31T19:17:10.003Z","repository":{"id":57185919,"uuid":"111108994","full_name":"parro-it/asynciterable","owner":"parro-it","description":"Basic async iterable class with buffer.","archived":false,"fork":false,"pushed_at":"2017-12-04T19:57:42.000Z","size":293,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-12T23:42:14.818Z","etag":null,"topics":[],"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/parro-it.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}},"created_at":"2017-11-17T13:53:47.000Z","updated_at":"2017-12-28T02:36:27.000Z","dependencies_parsed_at":"2022-09-06T04:12:10.998Z","dependency_job_id":null,"html_url":"https://github.com/parro-it/asynciterable","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parro-it%2Fasynciterable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parro-it%2Fasynciterable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parro-it%2Fasynciterable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parro-it%2Fasynciterable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/parro-it","download_url":"https://codeload.github.com/parro-it/asynciterable/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246523847,"owners_count":20791444,"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-26T00:23:47.865Z","updated_at":"2025-03-31T19:17:09.978Z","avatar_url":"https://github.com/parro-it.png","language":"JavaScript","readme":"# asynciterable\n\n[![Travis Build Status](https://img.shields.io/travis/parro-it/asynciterable/master.svg)](http://travis-ci.org/parro-it/asynciterable)\n[![NPM downloads](https://img.shields.io/npm/dt/asynciterable.svg)](https://npmjs.org/package/asynciterable)\n\n\u003e Async iterable class\n\nAsyncIterable is a class that implement the `async iterable` JavaScript pattern,\nusing a semantic similar to the promise one.\n\n## Usage\n\nCreate an async iterable that emit three numbers:\n\n```js\nimport AsyncIterable from 'asynciterable';\n\nconst numbers = new AsyncIterable((write, end, error) =\u003e {\n  write(1);\n  write(2);\n  write(3);\n  end();\n});\n\nfor await (const n of numbers) {\n  console.log(n)\n}\n\n// Output: 1\\n2\\n3\\n\n```\n\n## API\n\n\u003c!-- Generated by documentation.js. Update this documentation by updating the source code. --\u003e\n\n### AsyncIterable\n\nA class that implement the `async iterable` JavaScript pattern, using a semantic\nsimilar to the promise one.\n\n**Parameters**\n\n* `executor`\n  **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**\n  A function that is passed with the arguments write, end, error. The executor\n  function is executed immediately by the AsyncIterable implementation, passing\n  write, end and error functions (the executor is called before the\n  AsyncIterable constructor even returns the created object). The write\n  function, when called, make the async iterable emit a new item. The end\n  function, when called, make the async iterable end. The error function make it\n  throw an error. The executor normally initiates some asynchronous work, and\n  then, once a new item is available, it emit it by calling the write function,\n  or else call the error function if an error occurred. If an error is thrown in\n  the executor function, any subsequent call to iterator next is rejected with\n  the same error. The return value of the executor is ignored, unless if it is a\n  promise. In this case, when it fullfills to a rejection, error function is\n  automatically called.\n\n## Install\n\nWith [npm](https://npmjs.org/) installed, run\n\n```bash\nnpm install --save asynciterable\n```\n\n## See Also\n\n* [`noffle/common-readme`](https://github.com/noffle/common-readme)\n\n## License\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparro-it%2Fasynciterable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparro-it%2Fasynciterable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparro-it%2Fasynciterable/lists"}