# q-foreach2

> add foreach capability to Q

Latest version **1.0.11** (published 2015-10-07) · ISC license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install q-foreach2
pnpm add q-foreach2
yarn add q-foreach2
bun add q-foreach2
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.11 |
| Published | 2015-10-07 |
| First published | 2015-06-17 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | jujiyangasli@gmail.com |
| Maintainers | jujiyangasli |
| Keywords | q, foreach, array, promise |

## Links

- npm: https://www.npmjs.com/package/q-foreach2
- Repository: https://github.com/juji/q-foreach2
- Homepage: https://github.com/juji/q-foreach2#readme
- Issues: https://github.com/juji/q-foreach2/issues
- npm.io page: https://npm.io/package/q-foreach2

## Dependencies (1)

- [q](https://npm.io/package/q.md) ^1.4.1

## Alternatives

- [apollo-link-http-common](https://npm.io/package/apollo-link-http-common.md) — 879.0K weekly downloads
- [react-relay](https://npm.io/package/react-relay.md) — 336.8K weekly downloads
- [relay-test-utils](https://npm.io/package/relay-test-utils.md) — 181.6K weekly downloads
- [@vendure/core](https://npm.io/package/@vendure/core.md) — 14.8K weekly downloads
- [@pnpm/deps.graph-sequencer](https://npm.io/package/@pnpm/deps.graph-sequencer.md) — 13.4K weekly downloads

## Recent versions

- 1.0.11 (latest) — 2015-10-07
- 1.0.8 — 2015-06-17
- 1.0.7 — 2015-06-17
- 1.0.6 — 2015-06-17
- 1.0.5 — 2015-06-17
- 1.0.4 — 2015-06-17
- 1.0.3 — 2015-06-17

## README

#Q-foreach2

Adds `forEach` functionality to Kriskowal's  `q`

also works with objects

```javascript
var Q = require('q');
require('q-foreach2')(Q);

var arr = [1,2,3,4,5];
Q.forEach(arr,function(val,index){
	return Q.delay(500)
	.then(function(){
		console.log('Index: '+index);
		console.log('Value: '+val);
		return ++val;
	});
}).then(function(results){
	console.log(results);
	/*
	[
		{err:null, result:2},
		{err:null, result:3},
		{err:null, result:4},
		{err:null, result:5},
		{err:null, result:6}
	]
	*/
});
```

And for those lazy coders:
```
Q.foreach = Q.forEach;
```

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