Data structures, algorithms, and other useful functions written in TypeScript.
This package is still in development.
Install the package from npmjs.com.
npm install ts-datastructs-algos
bun add ts-datastructs-algos
yarn add ts-datastructs-algos
import { binarySearch } from 'ts-datastructs-algos'
const sortedArray = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
console.log(binarySearch(sortedArray, 5))
- hasDuplicates
- twoSums
- binarySearch
- linearSearch
- bubbleSort
- insertionSort
- selectionSort
- SinglyLinkedList
- DoublyLinkedList
- Stack
- Queue
- deepCopy
- swapArrayValues
Contributions are welcome!
- This project is intended to be readable by developers of all levels. This is intended to help developers contribute and learn concepts. Always avoid unnecessary shorthand code.
- Where possible, functions should be written in a immutable way and always return something.
- Include type checking at the beginning of functions for when TypeScript is not used or a runtime issue occurs.
- ESlint is provided for consistent styling. Do not modify the .eslintrc.yml file.
- Create a branch for your changes, create a pull request to 'development'. Pull requests on the 'main' branch are automatically published to npm.
- Avoid additional dependencies at all costs.
This project uses bun.sh.
Install it first if you plan on developing for this project.
Install packages with: Bun:
bun install
Run tests with:
bun test
Test are located in the ./tests directory.
bun run build
Note: bun build
will not work.
Build files are outputed to the ./dist folder.