sleepsort-promise
v1.1.3
Published
A Promise based implementation of Sleepsort, an O(wtf) sorting algorithm
Downloads
11
Maintainers
Readme
sleepsort-promise
A Promise
based implementation of the sleepsort algorithm.
Installation
npm install --save sleepsort-promise
yarn add sleepsort-promise
Usage
import sleepSort from 'sleepsort-promise';
const numbers = [3, 10, 6, 7, 100, 4, 25];
sleepSort(numbers)
.then((sortedNumbers) => {
console.log(sortedNumbers); // outputs: [3, 4, 6, 7, 10, 25, 100]
});
In case Promise
is not supported by your browser, you can alternatively use a callback.
sleepSort(numbers, function(sortedNumbers) {
console.log(sortedNumbers); // outputs: [3, 4, 6, 7, 10, 25, 100]
});
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request
License
MIT