Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

accumulate-values

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

accumulate-values

Accumulate values via a reducer

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

accumulate-values Build Status

Accumulate values via a reducer

Install

$ npm install --save accumulate-values

Usage

var accumulate = require('accumulate-values')
;[0, 1, 2].reduce(accumulate()) // => 3
;['0', '1', '2'].reduce(accumulate()) // => '012'
;[[0, 1], [2, 3]].reduce(accumulate()) // => 6

API

accumulate() -> function

Returns a function to be passed to Array.prototype.reduce. If the first item in the array is a number, future values are added to the initial value. If it is a string, future values are concatenated. If it is an array, future values are concatenated via [].concat.

License

MIT © Ben Drucker

Keywords

FAQs

Package last updated on 06 Jun 2015

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc