{"id":17749464,"url":"https://github.com/oresoftware/linked-queue","last_synced_at":"2026-03-08T22:32:36.186Z","repository":{"id":57134199,"uuid":"135954863","full_name":"ORESoftware/linked-queue","owner":"ORESoftware","description":"Linked-list / linked-queue for constant time operations on a FIFO queue.","archived":false,"fork":false,"pushed_at":"2024-10-31T20:28:01.000Z","size":224,"stargazers_count":2,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-20T01:52:28.907Z","etag":null,"topics":["doubly-linked-list","fifo","javascript","linked-list","linked-queue","nodejs","queue"],"latest_commit_sha":null,"homepage":"","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/ORESoftware.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-04T01:21:29.000Z","updated_at":"2024-10-31T20:28:05.000Z","dependencies_parsed_at":"2023-02-18T08:55:22.025Z","dependency_job_id":null,"html_url":"https://github.com/ORESoftware/linked-queue","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ORESoftware/linked-queue","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ORESoftware%2Flinked-queue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ORESoftware%2Flinked-queue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ORESoftware%2Flinked-queue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ORESoftware%2Flinked-queue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ORESoftware","download_url":"https://codeload.github.com/ORESoftware/linked-queue/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ORESoftware%2Flinked-queue/sbom","scorecard":{"id":103736,"data":{"date":"2025-08-11","repo":{"name":"github.com/ORESoftware/linked-queue","commit":"79a0d6725aa0c3f633be6539863e54a0fe1591f1"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"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":"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":"Code-Review","score":0,"reason":"Found 0/30 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":"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":"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":"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":"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":"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: license.md:0","Info: FSF or OSI recognized license: MIT License: license.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"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":"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-15T10:41:55.893Z","repository_id":57134199,"created_at":"2025-08-15T10:41:55.893Z","updated_at":"2025-08-15T10:41:55.893Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270684451,"owners_count":24627805,"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","status":"online","status_checked_at":"2025-08-16T02:00:11.002Z","response_time":91,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["doubly-linked-list","fifo","javascript","linked-list","linked-queue","nodejs","queue"],"created_at":"2024-10-26T11:23:25.988Z","updated_at":"2026-03-08T22:32:36.157Z","avatar_url":"https://github.com/ORESoftware.png","language":"TypeScript","readme":"\n\n## @oresoftware / linked-queue\n\n### Constant time queue\n\nThis an implementation of a FIFO queue, where all methods/operations are constant in time complexity.\n\nThe key proposition of this library is that it will allow you to remove or insert items from/in the middle of the queue,\nin constant time. It also allows you to add/remove items to/from the front of the queue in constant time.  Whereas, `Array.prototype.shift/Array.prototype.unshift`\nare O(N), because they have to update the indices of the entire array, etc.\n\nBecause any FIFO queue implementation using a basic JavaScript array will need to call either `Array.prototype.shift` or `Array.prototype.unshift`,\nyou might see a performance improvement right away when using big arrays, even if you don't need to insert or delete from the middle of your array.\n\n\u003cbr\u003e\n\n## Installation\n\n```bash\nnpm i @oresoftware/linked-queue\n```\n\n\u003cbr\u003e\n\n## Examples\n\n```js\nconst {LinkedQueue} from '@oresoftware/linked-queue';\nconst q = new LinkedQueue();\n\nq.enq({task:'foo'});       // adds item to the end/tail of the queue\nq.enqueue({task:'bar'});   // adds item to the end/tail of the queue\nq.push({task:'far'});      // adds item to the end/tail of the queue\n\nq.enq('foo', {task:'bbb'}); // adds item to the end/tail of the queue, with id/key = 'foo'\nq.get('foo'); // =\u003e {key: 'foo', value: {task:'bbb'}}\n\n\nq.enq({whatever:'is clever'}, {task:'bbb'}); // adds task to the end/tail of the queue, with id/key = {whatever:'is clever'}\n\n\nq.deq();      // =\u003e removes and returns the head of the queue, or null.\nq.dequeue();  // =\u003e removes and returns the head of the queue, or null.\nq.shift();    // =\u003e removes and returns the head of the queue, or null.\n\n\nq.peek(); // =\u003e returns the head of the queue, but does not remove it.\n\n```\n\n\u003cbr\u003e\n\n## More features\n\n### Removing/deleting items from the queue in constant time\n\nThis is a FIFO queue, but if you wanted to dequeue a item that was not the head of the queue, instead of using `q.deq()`, you\ncould just use `q.remove(id)`. Where id is the key/id of the item you wish to retrieve. And this would be\nin constant time. Removing items from the queue is useful if certain items in the queue have been obviated or are stale, etc.\n\n### Inserting items into the queue in constant time\n\nRemoving from the middle of the queue is an important feature - inserting items into the queue in linear time is also\nimportant. You can insert items into the queue in a certain location, in constant time, by using:\n\n```js\nq.insertInFrontOf(k1, k2, v);\nq.insertBehind(k1, k2, v);\n```\n\n### Inserting in non-constant time\n```js\nq.insertAtIndex(index, k, v);\n```\n\n\u003cbr\u003e\n\n## Further explanation\n\nA simple example of why this works is, with an array, each shift/unshift call is O(N), so the following takes 80 seconds!\n\n```js\nconst values = [];\n\nconst t = Date.now();\n\nfor (let i = 0; i \u003c 100000; i++) {\n  values.unshift({});\n}\n\nconsole.log('total time:', Date.now() - t); // takes almost 80 seconds!\n```\n\nHowever if we add to the front of a queue, with this library, it takes just 60ms.\u003cbr\u003e\nMore than 2 orders of magnitude difference. Huge.\n\n```js\nconst {LinkedQueue} = require('@oresoftware/linked-queue');\n\nconst q = new LinkedQueue();\n\nconst t = Date.now();\n\nfor (let i = 0; i \u003c 100000; i++) {\n  q.addToFront({});\n}\n\nconsole.log('total time:', Date.now() - t);  // just 60 milliseconds!\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foresoftware%2Flinked-queue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foresoftware%2Flinked-queue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foresoftware%2Flinked-queue/lists"}