{"id":13815827,"url":"https://github.com/js-sdsl/js-sdsl","last_synced_at":"2025-05-15T09:33:55.027Z","repository":{"id":37430245,"uuid":"439427889","full_name":"js-sdsl/js-sdsl","owner":"js-sdsl","description":"A javascript standard data structure library which benchmark against C++ STL.","archived":false,"fork":false,"pushed_at":"2024-10-13T02:54:02.000Z","size":4655,"stargazers_count":765,"open_issues_count":13,"forks_count":61,"subscribers_count":24,"default_branch":"main","last_synced_at":"2024-10-29T14:22:20.999Z","etag":null,"topics":["data-structure-library","data-structures","data-structures-and-algorithms","deque","dequeue","hashmap","hashset","hashsets","javascript","javascript-data-structures","javascript-library","linklist","map","priority-queue","rb-tree","red-black-tree","set","stl-containers","typescript","typescript-data-structure"],"latest_commit_sha":null,"homepage":"https://js-sdsl.org","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/js-sdsl.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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},"funding":{"open_collective":"js-sdsl","custom":["https://www.paypal.com/paypalme/zly201","https://www.paypal.com/paypalme/noname0310"]}},"created_at":"2021-12-17T18:35:14.000Z","updated_at":"2024-10-26T13:03:25.000Z","dependencies_parsed_at":"2023-02-14T00:01:24.873Z","dependency_job_id":"6f4d2d24-4d4e-46d5-81a9-f7cf7f8a6368","html_url":"https://github.com/js-sdsl/js-sdsl","commit_stats":{"total_commits":411,"total_committers":7,"mean_commits":"58.714285714285715","dds":"0.46472019464720193","last_synced_commit":"07d24014a3cb69adffa717ee1170824ac5b841c3"},"previous_names":[],"tags_count":43,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/js-sdsl%2Fjs-sdsl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/js-sdsl%2Fjs-sdsl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/js-sdsl%2Fjs-sdsl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/js-sdsl%2Fjs-sdsl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/js-sdsl","download_url":"https://codeload.github.com/js-sdsl/js-sdsl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224996545,"owners_count":17404485,"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":["data-structure-library","data-structures","data-structures-and-algorithms","deque","dequeue","hashmap","hashset","hashsets","javascript","javascript-data-structures","javascript-library","linklist","map","priority-queue","rb-tree","red-black-tree","set","stl-containers","typescript","typescript-data-structure"],"created_at":"2024-08-04T04:04:10.355Z","updated_at":"2024-11-19T11:31:09.581Z","avatar_url":"https://github.com/js-sdsl.png","language":"TypeScript","readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://js-sdsl.org/\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\n    \u003cimg src=\"https://js-sdsl.org/assets/image/logo/logo-removebg.png\" alt=\"js-sdsl logo\" width=\"120\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003ch3\u003e\u003cp align=\"center\"\u003eA javascript standard data structure library which benchmark against C++ STL\u003c/p\u003e\u003c/h3\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/js-sdsl\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/js-sdsl.svg\" alt=\"NPM Version\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/js-sdsl/js-sdsl/actions/workflows/build.yml\"\u003e\u003cimg src=\"https://img.shields.io/github/actions/workflow/status/js-sdsl/js-sdsl/build.yml\" alt=\"Build Status\" /\u003e\u003c/a\u003e\n  \u003ca href='https://coveralls.io/github/js-sdsl/js-sdsl?branch=main'\u003e\u003cimg src='https://coveralls.io/repos/github/js-sdsl/js-sdsl/badge.svg?branch=main' alt='Coverage Status' /\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/js-sdsl/js-sdsl\"\u003e\u003cimg src=\"https://img.shields.io/github/stars/js-sdsl/js-sdsl.svg\" alt=\"GITHUB Star\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://npmcharts.com/compare/js-sdsl?minimal=true\"\u003e\u003cimg src=\"https://img.shields.io/npm/dm/js-sdsl.svg\" alt=\"NPM Downloads\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://unpkg.com/js-sdsl/dist/umd/js-sdsl.min.js\"\u003e\u003cimg src=\"https://img.shields.io/bundlejs/size/js-sdsl\" alt=\"Gzip Size\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://opensource.org/licenses/MIT\"\u003e\u003cimg src=\"https://img.shields.io/npm/l/js-sdsl.svg\" alt=\"MIT-license\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/js-sdsl/js-sdsl/\"\u003e\u003cimg src=\"https://img.shields.io/github/languages/top/js-sdsl/js-sdsl.svg\" alt=\"GITHUB-language\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003eEnglish | \u003ca href=\"https://github.com/js-sdsl/js-sdsl/blob/main/README.zh-CN.md\"\u003e简体中文\u003c/a\u003e\u003c/p\u003e\n\n## ✨ Included data structures\n\n- **Stack** - first in last out stack.\n- **Queue** - first in first out queue.\n- **PriorityQueue** - heap-implemented priority queue.\n- **Vector** - protected array, cannot to operate properties like `length` directly.\n- **LinkList** - linked list of non-contiguous memory addresses.\n- **Deque** - double-ended-queue, O(1) time complexity to `unshift` or getting elements by index.\n- **OrderedSet** - sorted set which implemented by red black tree.\n- **OrderedMap** - sorted map which implemented by red black tree.\n- **HashSet** - refer to the [polyfill of ES6 Set](https://github.com/rousan/collections-es6).\n- **HashMap** - refer to the [polyfill of ES6 Map](https://github.com/rousan/collections-es6).\n\n## ⚔️ Benchmark\n\nWe are benchmarking against other popular data structure libraries. In some ways we're better than the best library. See [Benchmark](https://js-sdsl.org/#/test/benchmark-analyze).\n\n## 🖥 Supported platforms\n\n| ![][Edge-Icon]\u003cbr/\u003eIE / Edge | ![][Firefox-Icon]\u003cbr/\u003eFirefox | ![][Chrome-Icon]\u003cbr/\u003eChrome | ![][Safari-Icon]\u003cbr/\u003eSafari | ![][Opera-Icon]\u003cbr/\u003eOpera | ![][NodeJs-Icon]\u003cbr/\u003eNodeJs |\n|:----------------------------:|:-----------------------------:|:---------------------------:|:---------------------------:|:-------------------------:|:---------------------------:|\n|           Edge 12            |              36               |             49              |             10              |            36             |             10              |\n\n## 📦 Download\n\nDownload directly by cdn:\n\n- [js-sdsl.js](https://unpkg.com/js-sdsl/dist/umd/js-sdsl.js) (for development)\n- [js-sdsl.min.js](https://unpkg.com/js-sdsl/dist/umd/js-sdsl.min.js) (for production)\n\nOr install js-sdsl using npm:\n\n```bash\nnpm install js-sdsl\n```\n\nOr you can download the isolation packages containing only the containers you want:\n\n| package                                           | npm                                                                   | size                                                             | docs                        |\n|---------------------------------------------------|-----------------------------------------------------------------------|------------------------------------------------------------------|-----------------------------|\n| [@js-sdsl/stack][stack-package]                   | [![NPM Package][stack-npm-version]][stack-npm-link]                   | [![GZIP Size][stack-umd-size]][stack-umd-link]                   | [link][stack-docs]          |\n| [@js-sdsl/queue][queue-package]                   | [![NPM Package][queue-npm-version]][queue-npm-link]                   | [![GZIP Size][queue-umd-size]][queue-umd-link]                   | [link][queue-docs]          |\n| [@js-sdsl/priority-queue][priority-queue-package] | [![NPM Package][priority-queue-npm-version]][priority-queue-npm-link] | [![GZIP Size][priority-queue-umd-size]][priority-queue-umd-link] | [link][priority-queue-docs] |\n| [@js-sdsl/vector][vector-package]                 | [![NPM Package][vector-npm-version]][vector-npm-link]                 | [![GZIP Size][vector-umd-size]][vector-umd-link]                 | [link][vector-docs]         |\n| [@js-sdsl/link-list][link-list-package]           | [![NPM Package][link-list-npm-version]][link-list-npm-link]           | [![GZIP Size][link-list-umd-size]][link-list-umd-link]           | [link][link-list-docs]      |\n| [@js-sdsl/deque][deque-package]                   | [![NPM Package][deque-npm-version]][deque-npm-link]                   | [![GZIP Size][deque-umd-size]][deque-umd-link]                   | [link][deque-docs]          |\n| [@js-sdsl/ordered-set][ordered-set-package]       | [![NPM Package][ordered-set-npm-version]][ordered-set-npm-link]       | [![GZIP Size][ordered-set-umd-size]][ordered-set-umd-link]       | [link][ordered-set-docs]    |\n| [@js-sdsl/ordered-map][ordered-map-package]       | [![NPM Package][ordered-map-npm-version]][ordered-map-npm-link]       | [![GZIP Size][ordered-map-umd-size]][ordered-map-umd-link]       | [link][ordered-map-docs]    |\n| [@js-sdsl/hash-set][hash-set-package]             | [![NPM Package][hash-set-npm-version]][hash-set-npm-link]             | [![GZIP Size][hash-set-umd-size]][hash-set-umd-link]             | [link][hash-set-docs]       |\n| [@js-sdsl/hash-map][hash-map-package]             | [![NPM Package][hash-map-npm-version]][hash-map-npm-link]             | [![GZIP Size][hash-map-umd-size]][hash-map-umd-link]             | [link][hash-map-docs]       |\n\n## 🪒 Usage\n\nYou can visit our [official website](https://js-sdsl.org/) to get more information.\n\nTo help you have a better use, we also provide this [API document](https://js-sdsl.org/js-sdsl/index.html).\n\nFor previous versions of the documentation, please visit:\n\n`https://js-sdsl.org/js-sdsl/previous/v${version}/index.html`\n\nE.g.\n\n[https://js-sdsl.org/js-sdsl/previous/v4.1.5/index.html](https://js-sdsl.org/js-sdsl/previous/v4.1.5/index.html)\n\n### For browser\n\n```html\n\u003cscript src=\"https://unpkg.com/js-sdsl/dist/umd/js-sdsl.min.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n    const {\n      Vector,\n      Stack,\n      Queue,\n      LinkList,\n      Deque,\n      PriorityQueue,\n      OrderedSet,\n      OrderedMap,\n      HashSet,\n      HashMap\n    } = sdsl;\n    const myOrderedMap = new OrderedMap();\n    myOrderedMap.setElement(1, 2);\n    console.log(myOrderedMap.getElementByKey(1)); // 2\n\u003c/script\u003e\n```\n\n### For npm\n\n```javascript\n// esModule\nimport { OrderedMap } from 'js-sdsl';\n// commonJs\nconst { OrderedMap } = require('js-sdsl');\nconst myOrderedMap = new OrderedMap();\nmyOrderedMap.setElement(1, 2);\nconsole.log(myOrderedMap.getElementByKey(1)); // 2\n```\n\n## 🛠 Test\n\n### Unit test\n\nWe use [karma](https://karma-runner.github.io/) and [mocha](https://mochajs.org/) frame to do unit tests and synchronize to [coveralls](https://coveralls.io/github/js-sdsl/js-sdsl). You can run `yarn test:unit` command to reproduce it.\n\n### For performance\n\nWe tested most of the functions for efficiency. You can go to [`gh-pages/performance.md`](https://github.com/js-sdsl/js-sdsl/blob/gh-pages/performance.md) to see our running results or reproduce it with `yarn test:performance` command.\n\nYou can also visit [here](https://js-sdsl.org/#/test/performance-test) to get the result.\n\n## ⌨️ Development\n\nUse Gitpod, a free online dev environment for GitHub.\n\n[![Open in Gippod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/js-sdsl/js-sdsl)\n\nOr clone locally:\n\n```bash\n$ git clone https://github.com/js-sdsl/js-sdsl.git\n$ cd js-sdsl\n$ npm install\n$ npm run dev   # development mode\n```\n\nThen you can see the output in `dist/cjs` folder.\n\n## 🤝 Contributing\n\nFeel free to dive in! Open an issue or submit PRs. It may be helpful to read the [Contributor Guide](https://github.com/js-sdsl/js-sdsl/blob/main/.github/CONTRIBUTING.md).\n\n### Contributors\n\nThanks goes to these wonderful people:\n\n[![contributors](https://contrib.rocks/image?repo=js-sdsl/js-sdsl)](https://github.com/js-sdsl/js-sdsl/graphs/contributors)\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n\n## ❤️ Sponsors and Backers\n\nThe special thanks to these sponsors or backers because they provided support at a very early stage:\n\n\u003ca href=\"https://eslint.org/\"\u003e\u003cimg src=\"https://js-sdsl.org/assets/image/sponsors/eslint-logo-color.png\" alt=\"eslint logo\" width=\"150\"\u003e\u003c/a\u003e\n\nThanks also give to these sponsors or backers:\n\n[![sponsors](https://opencollective.com/js-sdsl/tiers/sponsors.svg?avatarHeight=36)](https://opencollective.com/js-sdsl#support)\n\n[![backers](https://opencollective.com/js-sdsl/tiers/backers.svg?avatarHeight=36)](https://opencollective.com/js-sdsl#support)\n\n## 🎫 License\n\n[MIT](https://github.com/js-sdsl/js-sdsl/blob/main/LICENSE) © [ZLY201](https://github.com/zly201)\n\n[Edge-Icon]: https://js-sdsl.org/assets/image/platform/edge.png\n[Firefox-Icon]: https://js-sdsl.org/assets/image/platform/firefox.png\n[Chrome-Icon]: https://js-sdsl.org/assets/image/platform/chrome.png\n[Safari-Icon]: https://js-sdsl.org/assets/image/platform/safari.png\n[Opera-Icon]: https://js-sdsl.org/assets/image/platform/opera.png\n[NodeJs-Icon]: https://js-sdsl.org/assets/image/platform/nodejs.png\n\n[stack-package]: https://github.com/js-sdsl/js-sdsl/blob/main/src/container/OtherContainer/Stack.ts\n[stack-npm-version]: https://img.shields.io/npm/v/@js-sdsl/stack\n[stack-npm-link]: https://www.npmjs.com/package/@js-sdsl/stack\n[stack-umd-size]: https://img.shields.io/bundlejs/size/@js-sdsl/stack\n[stack-umd-link]: https://unpkg.com/@js-sdsl/stack/dist/umd/stack.min.js\n[stack-docs]: https://js-sdsl.org/js-sdsl/classes/Stack.html\n\n[queue-package]: https://github.com/js-sdsl/js-sdsl/blob/main/src/container/OtherContainer/Queue.ts\n[queue-npm-version]: https://img.shields.io/npm/v/@js-sdsl/queue\n[queue-npm-link]: https://www.npmjs.com/package/@js-sdsl/queue\n[queue-umd-size]: https://img.shields.io/bundlejs/size/@js-sdsl/queue\n[queue-umd-link]: https://unpkg.com/@js-sdsl/queue/dist/umd/queue.min.js\n[queue-docs]: https://js-sdsl.org/js-sdsl/classes/Queue.html\n\n[priority-queue-package]: https://github.com/js-sdsl/js-sdsl/blob/main/src/container/OtherContainer/PriorityQueue.ts\n[priority-queue-npm-version]: https://img.shields.io/npm/v/@js-sdsl/priority-queue\n[priority-queue-npm-link]: https://www.npmjs.com/package/@js-sdsl/priority-queue\n[priority-queue-umd-size]: https://img.shields.io/bundlejs/size/@js-sdsl/priority-queue\n[priority-queue-umd-link]: https://unpkg.com/@js-sdsl/priority-queue/dist/umd/priority-queue.min.js\n[priority-queue-docs]: https://js-sdsl.org/js-sdsl/classes/PriorityQueue.html\n\n[vector-package]: https://github.com/js-sdsl/js-sdsl/blob/main/src/container/SequentialContainer/Vector.ts\n[vector-npm-version]: https://img.shields.io/npm/v/@js-sdsl/vector\n[vector-npm-link]: https://www.npmjs.com/package/@js-sdsl/vector\n[vector-umd-size]: https://img.shields.io/bundlejs/size/@js-sdsl/vector\n[vector-umd-link]: https://unpkg.com/@js-sdsl/vector/dist/umd/vector.min.js\n[vector-docs]: https://js-sdsl.org/js-sdsl/classes/Vector.html\n\n[link-list-package]: https://github.com/js-sdsl/js-sdsl/blob/main/src/container/SequentialContainer/LinkList.ts\n[link-list-npm-version]: https://img.shields.io/npm/v/@js-sdsl/link-list\n[link-list-npm-link]: https://www.npmjs.com/package/@js-sdsl/link-list\n[link-list-umd-size]: https://img.shields.io/bundlejs/size/@js-sdsl/link-list\n[link-list-umd-link]: https://unpkg.com/@js-sdsl/link-list/dist/umd/link-list.min.js\n[link-list-docs]: https://js-sdsl.org/js-sdsl/classes/LinkList.html\n\n[deque-package]: https://github.com/js-sdsl/js-sdsl/blob/main/src/container/SequentialContainer/Deque.ts\n[deque-npm-version]: https://img.shields.io/npm/v/@js-sdsl/deque\n[deque-npm-link]: https://www.npmjs.com/package/@js-sdsl/deque\n[deque-umd-size]: https://img.shields.io/bundlejs/size/@js-sdsl/deque\n[deque-umd-link]: https://unpkg.com/@js-sdsl/deque/dist/umd/deque.min.js\n[deque-docs]: https://js-sdsl.org/js-sdsl/classes/Deque.html\n\n[ordered-set-package]: https://github.com/js-sdsl/js-sdsl/blob/main/src/container/TreeContainer/OrderedSet.ts\n[ordered-set-npm-version]: https://img.shields.io/npm/v/@js-sdsl/ordered-set\n[ordered-set-npm-link]: https://www.npmjs.com/package/@js-sdsl/ordered-set\n[ordered-set-umd-size]: https://img.shields.io/bundlejs/size/@js-sdsl/ordered-set\n[ordered-set-umd-link]: https://unpkg.com/@js-sdsl/ordered-set/dist/umd/ordered-set.min.js\n[ordered-set-docs]: https://js-sdsl.org/js-sdsl/classes/OrderedSet.html\n\n[ordered-map-package]: https://github.com/js-sdsl/js-sdsl/blob/main/src/container/TreeContainer/OrderedMap.ts\n[ordered-map-npm-version]: https://img.shields.io/npm/v/@js-sdsl/ordered-map\n[ordered-map-npm-link]: https://www.npmjs.com/package/@js-sdsl/ordered-map\n[ordered-map-umd-size]: https://img.shields.io/bundlejs/size/@js-sdsl/ordered-map\n[ordered-map-umd-link]: https://unpkg.com/@js-sdsl/ordered-map/dist/umd/ordered-map.min.js\n[ordered-map-docs]: https://js-sdsl.org/js-sdsl/classes/OrderedMap.html\n\n[hash-set-package]: https://github.com/js-sdsl/js-sdsl/blob/main/src/container/HashContainer/HashSet.ts\n[hash-set-npm-version]: https://img.shields.io/npm/v/@js-sdsl/hash-set\n[hash-set-npm-link]: https://www.npmjs.com/package/@js-sdsl/hash-set\n[hash-set-umd-size]: https://img.shields.io/bundlejs/size/@js-sdsl/hash-set\n[hash-set-umd-link]: https://unpkg.com/@js-sdsl/hash-set/dist/umd/hash-set.min.js\n[hash-set-docs]: https://js-sdsl.org/js-sdsl/classes/HashSet.html\n\n[hash-map-package]: https://github.com/js-sdsl/js-sdsl/blob/main/src/container/HashContainer/HashMap.ts\n[hash-map-npm-version]: https://img.shields.io/npm/v/@js-sdsl/hash-map\n[hash-map-npm-link]: https://www.npmjs.com/package/@js-sdsl/hash-map\n[hash-map-umd-size]: https://img.shields.io/bundlejs/size/@js-sdsl/hash-map\n[hash-map-umd-link]: https://unpkg.com/@js-sdsl/hash-map/dist/umd/hash-map.min.js\n[hash-map-docs]: https://js-sdsl.org/js-sdsl/classes/HashMap.html\n","funding_links":["https://opencollective.com/js-sdsl","https://www.paypal.com/paypalme/zly201","https://www.paypal.com/paypalme/noname0310"],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjs-sdsl%2Fjs-sdsl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjs-sdsl%2Fjs-sdsl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjs-sdsl%2Fjs-sdsl/lists"}