array-deluxe
v1.0.15
Published
Function programming superpowers for your arrays
Downloads
5
Readme
Array-Deluxe 🦸♂️
Superpowers for your JavaScript arrays
import 'array-deluxe'
[1,2,3].map(x => x+1).unique().shuffle().mean()
Usage
Import
import 'array-deluxe'
// OR
require('array-deluxe')
Number functions
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
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