@extra-object/reduce

Reduces values to a single value.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@extra-object/reduce
032.2.52 years ago2 years agoMinified + gzip package size for @extra-object/reduce in KB

Readme

Reduces values to a single value. :running: :vhs: :package: :moon: :ledger:
Similar: map, reduce, filter, filterAt, reject, rejectAt.
This is part of package extra-object.

object.reduce(x, fr, [acc]);
// x:   an object
// fr:  reduce function (acc, v, k, x)
// acc: initial value

const object = require('extra-object');

var x = {a: 1, b: 2, c: 3, d: 4};
object.reduce(x, (acc, v) => acc+v);
// 10

object.reduce(x, (acc, v) => acc+v, 100);
// 110

references