reduce

v1.0.3
A better [].reduce

reduce build status

Example

Like Array.prototype.reduce but works on Object and accepts optional this value

var reduce = require("reduce")

reduce({
    key: "value"
    , key2: "value2"
    , ...
}, function (acc, value, key) {
    /* real code */
    acc[key] = value
    return acc
}, {
    this: "context"
}, {
    initial: "value"
})

Installation

npm install reduce

Contributors

  • Raynos

MIT Licenced

npm i reduce

Metadata

  • MIT
  • >= 0.4
  • Raynos
  • released 5/23/2024

Downloads

Maintainers