{"id":17918801,"url":"https://github.com/mourner/tinyqueue","last_synced_at":"2025-04-13T22:29:37.948Z","repository":{"id":30909888,"uuid":"34467722","full_name":"mourner/tinyqueue","owner":"mourner","description":"The smallest and simplest priority queue in JavaScript.","archived":false,"fork":false,"pushed_at":"2024-07-06T08:59:34.000Z","size":38,"stargazers_count":440,"open_issues_count":2,"forks_count":46,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-01-08T21:43:36.358Z","etag":null,"topics":["algorithm","binary-heap","data-structure","javascript","priority-queue"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mourner.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":"2015-04-23T16:23:18.000Z","updated_at":"2025-01-03T22:13:17.000Z","dependencies_parsed_at":"2024-06-18T12:19:54.737Z","dependency_job_id":"03f37d80-0bb6-4c1e-98ac-9c3ef4866ddb","html_url":"https://github.com/mourner/tinyqueue","commit_stats":{"total_commits":52,"total_committers":10,"mean_commits":5.2,"dds":"0.23076923076923073","last_synced_commit":"abe2b88f3c994263ae92c6453c71c6c2c4d71e0b"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mourner%2Ftinyqueue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mourner%2Ftinyqueue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mourner%2Ftinyqueue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mourner%2Ftinyqueue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mourner","download_url":"https://codeload.github.com/mourner/tinyqueue/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248790477,"owners_count":21162014,"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":["algorithm","binary-heap","data-structure","javascript","priority-queue"],"created_at":"2024-10-28T20:12:53.560Z","updated_at":"2025-04-13T22:29:37.915Z","avatar_url":"https://github.com/mourner.png","language":"JavaScript","readme":"## tinyqueue\n\nThe smallest and simplest binary heap priority queue in JavaScript.\n\n```js\n// create an empty priority queue\nlet queue = new TinyQueue();\n\n// add some items\nqueue.push(7);\nqueue.push(5);\nqueue.push(10);\n\n// remove the top item\nlet top = queue.pop(); // returns 5\n\n// return the top item (without removal)\ntop = queue.peek(); // returns 7\n\n// get queue length\nqueue.length; // returns 2\n\n// create a priority queue from an existing array (modifies the array)\nqueue = new TinyQueue([7, 5, 10]);\n\n// pass a custom item comparator as a second argument\nqueue = new TinyQueue([{value: 5}, {value: 7}], function (a, b) {\n\treturn a.value - b.value;\n});\n\n// turn a queue into a sorted array\nconst array = [];\nwhile (queue.length) array.push(queue.pop());\n```\n\nFor a faster number-based queue, see [flatqueue](https://github.com/mourner/flatqueue).\n\n### Install\n\nInstall using NPM (`npm install tinyqueue`), then import as a module:\n\n```js\nimport TinyQueue from 'tinyqueue';\n```\n\nOr use a browser build from a CDN:\n\n```html\n\u003cscript type=\"module\"\u003e\n\timport TinyQueue from 'https://cdn.jsdelivr.net/npm/tinyqueue/+esm';\n```\n\n### Thanks\n\nInspired by [js-priority-queue](https://github.com/adamhooper/js-priority-queue)\nby [Adam Hooper](https://github.com/adamhooper).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmourner%2Ftinyqueue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmourner%2Ftinyqueue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmourner%2Ftinyqueue/lists"}