Socket
Socket
Sign inDemoInstall

array-reduce

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    array-reduce

`[].reduce()` for old browsers


Version published
Weekly downloads
589K
increased by5.83%
Maintainers
1
Install size
6.08 kB
Created
Weekly downloads
 

Readme

Source

array-reduce

[].reduce() for old browsers

testling badge

build status

example

var reduce = require('array-reduce');
var xs = [ 1, 2, 3, 4 ];
var sum = reduce(xs, function (acc, x) { return acc + x }, 0);
console.log(sum);

output:

10

methods

var reduce = require('array-reduce')

var res = reduce(xs, f, init)

Create a result res by folding acc = f(acc, xs[i], i) over each element in the array xs at element i. If init is given, the first acc value is init, otherwise xs[0] is used.

install

With npm do:

npm install array-reduce

license

MIT

Keywords

FAQs

Last updated on 25 Dec 2013

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc