Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rayriffy/instant-sort
The fastest sorting algorithm ever with the speed of O(1)
https://github.com/rayriffy/instant-sort
sorting-algorithms typescript
Last synced: 17 days ago
JSON representation
The fastest sorting algorithm ever with the speed of O(1)
- Host: GitHub
- URL: https://github.com/rayriffy/instant-sort
- Owner: rayriffy
- License: mit
- Created: 2019-11-14T04:13:48.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-07-19T14:48:32.000Z (over 4 years ago)
- Last Synced: 2024-10-11T13:27:05.824Z (about 1 month ago)
- Topics: sorting-algorithms, typescript
- Language: TypeScript
- Size: 173 KB
- Stars: 14
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Instant Sort
============The fastest sorting algorithm ever with the speed of **O(1)**
[![npm](https://img.shields.io/npm/v/instant-sort.svg)](http://npm.im/instant-sort)
[![npm bundle size](https://img.shields.io/bundlephobia/min/instant-sort)](https://bundlephobia.com/result?p=instant-sort)Installation
------------```
npm install instant-sort
```Examples
--------```javascript
const { sort } = require('instant-sort')
function isSorted(arr) {
originalArr = arr.toString()
arr.sort(function(a,b){
return a - b;
})return arr.toString() === originalArr;
}
const unsortedArray = [4, 1, 5, 2, 6, 9]
console.log(isSorted(unsortedArray)) // false
console.log(isSorted(sort(unsortedArray))) // true
```TypeScript
----------Yes, this module is TypeScript-friendly! No need for DefinitelyTyped
```tsx
const res = sort>([
{
name : {
romaji: 'Toaru Kagaku no Railgun T',
english: 'A Certain Scientific Railgun T',
native: 'とある科学の超電磁砲T',
},
},
{
name : {
romaji: 'Itai no wa Iya nanode Bougyo-Ryoku ni Kyokufuri Shitai to Omoimasu',
english: `BOFURI: I Don't Want to Get Hurt, so I'll Max Out My Defense.`,
native: '痛いのは嫌なので防御力に極振りしたいと思います。'
},
},
])console.log(res) // Should return sorted array
```Contributing
------------We welcome all contributions by sending PR to this repository.
Need Help ?
-----------If you need help with anything, here're following methods:
#### Create an Issue
If you have something you want to discuss in detail, or have hit an issue which you believe others will also have in deployment or development of the system, [opening an issue](https://github.com/rayriffy/instant-sort/issues) is the best way to get help. It creates a permanent resource for others wishing to contribute to conversation.
Donations
---------If you like my project, please supporting me by [buying some coffee](https://www.buymeacoffee.com/rayriffy)