js-sdsl logo

A javascript standard data structure library which benchmark against C++ STL

NPM Version Build Status Coverage Status GITHUB Star NPM Downloads Gzip Size Rate this package MIT-license GITHUB-language

English | 简体中文

## Included data structures - Vector - Stack - Queue - LinkList - Deque - PriorityQueue - OrderedSet (using RBTree) - OrderedMap (using RBTree) - HashSet - HashMap ## Benchmark We are benchmarking against other popular data structure libraries. In some ways we're better than the best library. See [benchmark](https://js-sdsl.github.io/#/test/benchmark-analyze). ## Supported platforms - node.js (using commonjs) - react/vue (using es5) - browser (support most browsers) ## Download Download directly - [js-sdsl.js](https://unpkg.com/js-sdsl/dist/umd/js-sdsl.js) (for development) - [js-sdsl.min.js](https://unpkg.com/js-sdsl/dist/umd/js-sdsl.min.js) (for production) Or install js-sdsl using npm ```bash npm install js-sdsl ``` ## Usage You can visit our [official website](https://js-sdsl.github.io/) to get more information. To help you have a better use, we also provide this [API document](https://js-sdsl.github.io/js-sdsl/index.html). ### For browser ```html ``` ### For npm ```javascript // esModule import { OrderedMap } from 'js-sdsl'; // commonJs const { OrderedMap } = require('js-sdsl'); const myOrderedMap = new OrderedMap(); myOrderedMap.setElement(1, 2); console.log(myOrderedMap.getElementByKey(1)); // 2 ``` ## Build by source code You can pull this repository and run `yarn build` to rebuild this library. ## Test ### Unit test We use jest library to write unit tests, you can see test coverage on [coveralls](https://coveralls.io/github/js-sdsl/js-sdsl). You can run `yarn test:unit` command to reproduce it. ### For performance We 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. You can also visit [here](https://js-sdsl.github.io/#/test/performance-test) to get the result. ## Maintainers [@ZLY201](https://github.com/ZLY201) ## Contributing Feel 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). ### Contributors Thanks goes to these wonderful people:

Takatoshi Kondo

💻 ⚠️
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! ## License [MIT](https://github.com/js-sdsl/js-sdsl/blob/main/LICENSE) © ZLY201