# accumulate-values

> Accumulate values via a reducer

Latest version **1.0.0** (published 2015-06-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install accumulate-values
pnpm add accumulate-values
yarn add accumulate-values
bun add accumulate-values
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2015-06-06 |
| First published | 2015-06-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ben Drucker |
| Maintainers | bendrucker |
| Keywords | accumulate, reduce, array, string |

## Links

- npm: https://www.npmjs.com/package/accumulate-values
- Repository: https://github.com/bendrucker/accumulate-values
- Homepage: https://github.com/bendrucker/accumulate-values#readme
- Issues: https://github.com/bendrucker/accumulate-values/issues
- npm.io page: https://npm.io/package/accumulate-values

## Dependencies (1)

- [isarray](https://npm.io/package/isarray.md) 0.0.1

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2015-06-06

## README

# accumulate-values [![Build Status](https://travis-ci.org/bendrucker/accumulate-values.svg?branch=master)](https://travis-ci.org/bendrucker/accumulate-values)

> Accumulate values via a reducer

## Install

```
$ npm install --save accumulate-values
```


## Usage

```js
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](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/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](http://bendrucker.me)

---
_Source: https://npm.io/package/accumulate-values · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
