Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bukinoshita/sort-arr
A tiny (110b), fast and simplified array sort
https://github.com/bukinoshita/sort-arr
arr array array-sort javascript nodejs sort
Last synced: 24 days ago
JSON representation
A tiny (110b), fast and simplified array sort
- Host: GitHub
- URL: https://github.com/bukinoshita/sort-arr
- Owner: bukinoshita
- License: mit
- Created: 2017-07-06T18:16:07.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-12T10:48:35.000Z (almost 2 years ago)
- Last Synced: 2024-10-10T16:08:00.441Z (about 1 month ago)
- Topics: arr, array, array-sort, javascript, nodejs, sort
- Language: JavaScript
- Homepage:
- Size: 392 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 10
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# sort-arr [![Build Status](https://travis-ci.org/bukinoshita/sort-arr.svg?branch=master)](https://travis-ci.org/bukinoshita/sort-arr)
> A tiny (110B), fast and simplified array sort
## Install
```
$ npm install --save sort-arr
```## Usage
```js
const sortArr = require('sort-arr')const arr = [
{ band: 'Lights', members: 1 },
{ band: 'Blink-182', members: 3 },
{ band: 'Jamestown Story', members: 1 }
]sortArr(arr, 'band')
/* => [
{ band: 'Blink-182', members: 3 },
{ band: 'Jamestown Story', members: 1 },
{ band: 'Lights', members: 1 }
]
*/
```## API
### sortArr(arr, key)
Returns an `array`
#### arr
Type: `array`
Array to be sorted
#### key
Type: `string`
Name of the object key
## Benchmarks
```
// Fastest is sort-arrsort-array
--> 35,101 ops/sec ±4.01% (85 runs sampled) | Diff: N/Aarray-sort
--> 186,025 ops/sec ±8.78% (70 runs sampled) | Diff: 429.97% fastersort-arr
--> 1,014,953 ops/sec ±6.87% (76 runs sampled) | Diff: 445.60% faster
```## License
MIT © [Bu Kinoshita](https://bukinoshita.io)