# add-counter

> Adds a counter integer to iterated values.

Latest version **1.0.0** (published 2018-02-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install add-counter
pnpm add add-counter
yarn add add-counter
bun add add-counter
```

## 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 | 2018-02-05 |
| First published | 2018-02-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6.0.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | John Lamansky |
| Maintainers | lamansky |
| Keywords | add, iterator, iteration, counter |

## Links

- npm: https://www.npmjs.com/package/add-counter
- Repository: https://github.com/lamansky/add-counter
- Issues: https://github.com/lamansky/add-counter/issues
- npm.io page: https://npm.io/package/add-counter

## Recent versions

- 1.0.0 (latest) — 2018-02-05

## README

# add-counter

Adds a counter integer to iterated values.

## Installation

Requires [Node.js](https://nodejs.org/) 6.0.0 or above.

```bash
npm i add-counter
```

## API

The module exports a single function.

### Parameters

1. `iter` (iterable): The underlying iterable.
2. Optional: `i` (integer): The starting value of the counter. Normally this would be either `0` or `1`. Defaults to `0`.

### Return Value

A generator that, for each iterated value `x`, yields `[i++, x]`

## Example

```javascript
const addCounter = require('add-counter')

for (const [i, x] of addCounter(['a', 'b', 'c'])) {
  // [0, 'a']
  // [1, 'b']
  // [2, 'c']
}
```

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