JSPM

poly-reduce

0.1.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q17667F
  • License Apache-2.0

Reduce that can be used with objects and arrays

Package Exports

  • poly-reduce

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (poly-reduce) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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