{"id":15387100,"url":"https://github.com/wildhoney/orderlyqueue","last_synced_at":"2025-04-15T20:14:05.739Z","repository":{"id":57316114,"uuid":"73128013","full_name":"Wildhoney/OrderlyQueue","owner":"Wildhoney","description":"Implementation of a promise-based FIFO queuing system using ES2017 async generators.","archived":false,"fork":false,"pushed_at":"2017-01-20T09:06:25.000Z","size":64,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-15T20:13:57.845Z","etag":null,"topics":["async","asynchronous","await","consecutive","consecutively","fifo","observable","promise","promises","queue","task","yield"],"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/Wildhoney.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":"2016-11-07T22:48:39.000Z","updated_at":"2021-03-21T13:19:13.000Z","dependencies_parsed_at":"2022-08-25T20:40:46.049Z","dependency_job_id":null,"html_url":"https://github.com/Wildhoney/OrderlyQueue","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wildhoney%2FOrderlyQueue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wildhoney%2FOrderlyQueue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wildhoney%2FOrderlyQueue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wildhoney%2FOrderlyQueue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Wildhoney","download_url":"https://codeload.github.com/Wildhoney/OrderlyQueue/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249145419,"owners_count":21219966,"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":["async","asynchronous","await","consecutive","consecutively","fifo","observable","promise","promises","queue","task","yield"],"created_at":"2024-10-01T14:51:59.604Z","updated_at":"2025-04-15T20:14:05.714Z","avatar_url":"https://github.com/Wildhoney.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Orderly Queue\n\n![Bus Queue](/media/bus-queue.jpg)\n\n\u003e Implementation of a promise-based FIFO queuing system using ES2017 async generators.\n\n![Travis](http://img.shields.io/travis/Wildhoney/OrderlyQueue.svg?style=flat-square)\n\u0026nbsp;\n![npm](http://img.shields.io/npm/v/orderly-queue.svg?style=flat-square)\n\u0026nbsp;\n![License MIT](http://img.shields.io/badge/License-MIT-lightgrey.svg?style=flat-square)\n\n\u003e **npm:** `npm i orderly-queue -S`\u003cbr /\u003e\n\u003e **Babel:** [`babel-plugin-syntax-async-generators`](https://www.npmjs.com/package/babel-plugin-syntax-async-generators)\n\n* Takes a function that returns a promise (or `Promise.all`)\n* Invokes the promise and `yield`s the eventual result\n* Awaits the completion of the task before beginning the next\n* Implements a pseudo-observable for `next` and `error`\n* Passes the returned `props` along to the next task\n\n# Usage\n\n```javascript\nimport Queue from 'orderly-queue';\n\nconst queue = Queue({ value: ['Blueberries'], next: console.log });\n\nqueue.process(fruits =\u003e Promise.resolve([...fruits, 'Apples']));\nqueue.process(fruits =\u003e Promise.resolve([...fruits, 'Bananas']));\nqueue.process(fruits =\u003e Promise.resolve([...fruits, 'Raspberries']));\n\n// \u003e ['Blueberries']\n// \u003e ['Blueberries', 'Apples']\n// \u003e ['Blueberries', 'Apples', 'Bananas']\n// \u003e ['Blueberries', 'Apples', 'Bananas', 'Raspberries']\n```\n\nEach task will wait before the completion of the current task, meaning you can safely assume the order of `fruits` no matter how long it takes for a single task to complete.\n\n## Errors\n\nAny errors that are raised will be passed to the `error` function, however the items in the queue will continue to be invoked one-at-a-time passing in the `props` from the last successful invocation.\n\n```javascript\nimport Queue from 'orderly-queue';\n\nconst queue = Queue({ value: ['Blueberries'], next: console.log, error: console.log });\n\nqueue.process(fruits =\u003e Promise.resolve([...fruits, 'Apples']));\nqueue.process(fruits =\u003e Promise.reject('Error: Fruitless...'));\nqueue.process(fruits =\u003e Promise.resolve([...fruits, 'Bananas']));\nqueue.process(fruits =\u003e Promise.resolve([...fruits, 'Raspberries']));\n\n// \u003e ['Blueberries']\n// \u003e ['Blueberries', 'Apples']\n// \u003e Error: Fruitless...\n// \u003e ['Blueberries', 'Apples', 'Bananas']\n// \u003e ['Blueberries', 'Apples', 'Bananas', 'Raspberries']\n```\n\nIn cases where you wish to end the iterator early you can invoke the `abort` method \u0026mdash; perhaps in response to an error being raised. Any queued tasks will not be run.\n\n```javascript\nconst queue = Queue({ value: ['Blueberries'], next: console.log, error: console.log });\n\n// ...\n\nqueue.abort();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwildhoney%2Forderlyqueue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwildhoney%2Forderlyqueue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwildhoney%2Forderlyqueue/lists"}