Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jasonheecs/js-sorting
An npm package containing implementations of various sorting algorithms in Javascript.
https://github.com/jasonheecs/js-sorting
cs-algorithms javascript npm-package sorting-algorithms
Last synced: 7 days ago
JSON representation
An npm package containing implementations of various sorting algorithms in Javascript.
- Host: GitHub
- URL: https://github.com/jasonheecs/js-sorting
- Owner: jasonheecs
- License: mit
- Created: 2018-04-15T19:26:06.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-13T05:48:29.000Z (almost 2 years ago)
- Last Synced: 2024-09-22T05:18:39.132Z (about 2 months ago)
- Topics: cs-algorithms, javascript, npm-package, sorting-algorithms
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/@jasonheecs/js-sorting
- Size: 636 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Sorting Algorithms in Javascript
[![Build Status](https://travis-ci.org/jasonheecs/js-sorting.svg?branch=master)](https://travis-ci.org/jasonheecs/js-sorting) [![Coverage Status](https://coveralls.io/repos/github/jasonheecs/js-sorting/badge.svg)](https://coveralls.io/github/jasonheecs/js-sorting)A package containing implementations of various sorting algorithms in Javascript. This project is mainly a learning exercise and personal refresher on the common CS sorting algos, in addition to playing around with test coverage reports with [coveralls](https://coveralls.io/)
## Installation
`npm install @jasonheecs/js-sorting --save`## Usage
```js
var {selectionSort} = require('@jasonheecs/js-sorting');
var {bubbleSort} = require('@jasonheecs/js-sorting');
var {insertionSort} = require('@jasonheecs/js-sorting');
var {mergeSort} = require('@jasonheecs/js-sorting');
var {quickSort} = require('@jasonheecs/js-sorting');var items = [5, 2, 1, 3, 6, 4];
console.log(selectionSort(items));
console.log(bubbleSort(items));
console.log(insertionSort(items));
console.log(mergeSort(items));
console.log(quickSort(items));
```## Running unit tests
`npm test`To run a specific test file, you can use an extra `--` to pass the filename through:
`npm test -- test/bubble-sort-test.js`## License
MIT