Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/arnaudsm/array-deluxe

Superpowers for your JavaScript arrays 🦸
https://github.com/arnaudsm/array-deluxe

array functional-programming groupby list pipes

Last synced: 3 days ago
JSON representation

Superpowers for your JavaScript arrays 🦸

Awesome Lists containing this project

README

        

# Array-Deluxe πŸ¦Έβ€β™‚οΈ
Superpowers for your JavaScript arrays
```js
import 'array-deluxe'

[1,2,3].map(x => x+1).unique().shuffle().mean()
```

# Usage

## Import
```js
import 'array-deluxe'
// OR
require('array-deluxe')
```

## Number functions
```js
const list = [1,1,3]
list.max() // 3
list.min() // 1
list.sum() // 5
list.median() // 1
list.mean() // 2.5
list.unique() // [1,3]
list.shuffle() // [1,3,1]
```
## Object functions
```js
const people = [
{name:"snap", age:21},
{name:"pop", age:23},
{name:"crackle", age:21},
];
people.select("name") // ["snap","pop","crackle"]
people.max("age") // 23
people.min("age") // 21
people.sum("age") // 65
people.median("age") // 21
people.mean("age") // 21.6..
```

# Todo
- Tests
- TypeScript support