poly-reduce

0.1.1 • Public • Published

poly-reduce

https://travis-ci.org/koralarts/poly-reduce.svg?branch=master

Use reduce with not only Arrays but also with Objects in Javascript.

Examples

var reduce = require('poly-reduce');

var arr = [
  1,
  2,
  3,
  4,
  5
]

function callback(accum, item) {
    return accum + item;
}

reduce(callback, 0, arr); // 15

var = obj {
  one: 1,
  two: 2,
  three: 3,
  four: 4,
  five: 5
}

reduce(callback, 0, obj); // 15

Test

npm test

Package Sidebar

Install

npm i poly-reduce

Weekly Downloads

2

Version

0.1.1

License

Apache-2.0

Unpacked Size

15.2 kB

Total Files

7

Last publish

Collaborators

  • machobearstudio