{"id":15011273,"url":"https://github.com/mearns/queue-as-promised","last_synced_at":"2026-02-18T00:31:36.422Z","repository":{"id":78409799,"uuid":"110017382","full_name":"mearns/queue-as-promised","owner":"mearns","description":"A JavaScript library for queueing up tasks, both synchronous and asynchronous.","archived":false,"fork":false,"pushed_at":"2018-08-24T12:32:16.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-20T03:30:39.435Z","etag":null,"topics":["ayo","fifo","fifo-queue","javascript","javascript-library","node","node-js","nodejs","queue"],"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/mearns.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-11-08T18:56:17.000Z","updated_at":"2018-08-24T12:32:18.000Z","dependencies_parsed_at":"2023-03-02T01:30:25.452Z","dependency_job_id":null,"html_url":"https://github.com/mearns/queue-as-promised","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/mearns/queue-as-promised","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mearns%2Fqueue-as-promised","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mearns%2Fqueue-as-promised/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mearns%2Fqueue-as-promised/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mearns%2Fqueue-as-promised/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mearns","download_url":"https://codeload.github.com/mearns/queue-as-promised/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mearns%2Fqueue-as-promised/sbom","scorecard":{"id":633790,"data":{"date":"2025-08-11","repo":{"name":"github.com/mearns/queue-as-promised","commit":"09b47eea3b74979b34231591682ed338b26f7a47"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/19 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-21T08:34:01.875Z","repository_id":78409799,"created_at":"2025-08-21T08:34:01.875Z","updated_at":"2025-08-21T08:34:01.875Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29563467,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-17T21:50:49.831Z","status":"ssl_error","status_checked_at":"2026-02-17T21:46:15.313Z","response_time":100,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["ayo","fifo","fifo-queue","javascript","javascript-library","node","node-js","nodejs","queue"],"created_at":"2024-09-24T19:40:06.082Z","updated_at":"2026-02-18T00:31:36.414Z","avatar_url":"https://github.com/mearns.png","language":"JavaScript","readme":"[![Build Status](https://travis-ci.org/mearns/queue-as-promised.svg?branch=master)](https://travis-ci.org/mearns/queue-as-promised)\n[![JavaScript Standard Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n\n# queue-as-promised\n\nA JavaScript library for queueing up tasks, both synchronous and asynchronous.\n\n## Install\n\n```console\nnpm install queue-as-promised\n```\n\n## Overview\n\nYou have some tasks to perform and you need to queue them up. Maybe because they all share\na resource so you can only have one running at a time. Doesn't matter why. You define a function\nthat will run your task, and register with a `Queue`. The registered tasks will be executed one\nat a time, in order, and notify you when they're done.\n\n## Usage\n\n```javascript\nimport {Queue} from 'queue-as-promised'\n\nconst q = new Queue()\n\nq.enqueue(() =\u003e {\n  doSomeSynchronousWork()\n})\n  .then(() =\u003e {\n    console.log('Synchronous task complete')\n  })\n\nq.enqueue(() =\u003e {\n  return promiseToDoSomeWork()\n}\n  .then(() =\u003e {\n    console.log('Asynchronous task complete')\n  })\n```\n\n## In Depth\n\nFor our purposes, a task is some unit of work that has a definitive end point, though the\nend point is not necessarily known in advance. This work could be completely synchronous, or\nit could be asynchronous.\n\nYou create a new instance of a `Queue` and register your task with it by calling the\n`enqueue` method. You pass in a function which will actually perform your task.\nThis function will be invoked by the queue once all previously registered tasks are completed.\n\nIf your task function is completely synchronous, then returning normally from the function will\nindicate that your task is complete. Likewise, if an exception is thrown from your task function,\nthe task is considered to be complete.\n\nIf your task requires asynchronous work, then your task function should return a promise which\nwill settle when your task is complete. Whether your promise fulfills or rejects is immaterial, the\nact of settling to either of those states causes the queue to consider the task complete.\n\nThe `enqueue` method also returns a promise of its own, which will settle based on your task\nfunction. Specifically, it will fulfill once your task completes successfully (returns normally\nor returns a promise which eventually fulfills), or will reject if your task fails (either the task\nfunction throws an error, or it returns a promise that eventually rejects).\n\nIf your task function results in some value, the returned promise will fulfill with it. If your task\nfunction fails for some error, the returned promise will reject with that reason.\n\nThe returned promise allows you to take action in response to the completion of your task, without\nprolonging the task from the point of view of the queue. While you can always cram additional work\ninto your task function, the queue will not move on to the next task until that work is completed. If\nthere is follow on work that you want to do, but don't want to block subsequent tasks because of it,\nthen you should chain that work onto the returned promise instead of inside the task function.\n\nYou can optionally pass in an initial parameter which is called the *item*. This value will be\npassed along as the only argument to the provided task function. This allows you to reuse the same\ntask function for different tasks, which can then be parameterized by the item.\n\nNote that the item will be serialized and deserialized before being passed to the task function. If\nan error occurs during this process, then the promise returned by the call to `enqueue` will reject.\nFor instance, objects with circular references will err during serialization.\n\n## API\n\n## `Queue::enqueue([item, ] taskFunction)`\n\n```\nQueue::enqueue\u003cI, R\u003e([item: I, ] taskFunction: (I) -\u003e R | (I) -\u003e Promise\u003cR\u003e): Promise\u003cR\u003e`\n```\n\nRegisters the given `taskFunction` as a task in the queue.\n\n### parameters\n\n*   `item` -  An optional value which will be serialized and deserialized, then passed to your task\n    function when it is called.\n*   `taskFunction` - The actual task function which will be called\n    when it reaches the front of the queue, with\n    the provided item passed in as the sole argument (after being serialized and deserialized).\n\n    It can return a value of any type, or return a promise for any type.\n    The promise returned by `enqueue` will fulfill with the returned value,\n    or adopt the state of the returned promise.\n\n### returns\n\nA promise for the value returned by `taskFunction`, or a promise which adopts the state of a promise\nreturned by the task function. If the task function throws an error, the returned promise will reject\nwith that error. Additionally, if an error occurs attempting to serialize the given `item`, the returned\npromise will reject. It is not specified when this rejection will occur, it does not necessarily wait\nfor the task to reach the front of the queue.\n\n## Promises\n\nFor all parameters specified as being \"Promises\", any *thennable* can be used and will be resolved to\na promise according to the [Promises/A+](https://promisesaplus.com/) specification. Returned promises\nalso follow the A+ spec, but the specific implementation is not guaranteed. If you need a promise of\nparticular implementation, you should use that implementation's utilities to convert it to a promise of\nthat type (e.g., [Bluebird.resolve](http://bluebirdjs.com/docs/api/promise.resolve.html))\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmearns%2Fqueue-as-promised","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmearns%2Fqueue-as-promised","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmearns%2Fqueue-as-promised/lists"}