# cooperator

> Like co but lets you also output data

Latest version **0.0.6** (published 2014-06-18) · 0 weekly downloads

## Install

```sh
npm install cooperator
pnpm add cooperator
yarn add cooperator
bun add cooperator
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2014-06-18 |
| First published | 2014-06-10 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | CoderPuppy |
| Maintainers | drewyoung1 |

## Links

- npm: https://www.npmjs.com/package/cooperator
- Repository: https://github.com/CoderPuppy/cooperator
- Issues: https://github.com/CoderPuppy/cooperator/issues
- npm.io page: https://npm.io/package/cooperator

## Dependencies (2)

- [thunkifyer](https://npm.io/package/thunkifyer.md) ^0.0.3
- [pull-pushable](https://npm.io/package/pull-pushable.md) ^1.1.4

## Recent versions

- 0.0.6 (latest) — 2014-06-18
- 0.0.5 — 2014-06-10
- 0.0.4 — 2014-06-10
- 0.0.3 — 2014-06-10
- 0.0.1 — 2014-06-10
- 0.0.0 — 2014-06-10

## README

# Cooperator

## Usage
```javascript
var cooperator = require('cooperator')
var sleep = require('co-sleep')
var co = cooperator(function*() {
	yield 'foo'
	yield sleep(2000)
	yield 'bar'
	yield sleep(2000)
	yield 'baz'
}).on('data', function(data) {
	console.log('data', data)
}).on('error', function(err) {
	console.error('error', err.stack)
}).on('done', function(res) {
	console.log('done', res)
}).start()
// yields
// data foo
// data bar
// data baz
// done undefined
```

## API
- `co = cooperator(gen)` - Creates a cooperator from gen (can be a generator or a generator function)
- `co.start()` - Start it
- `co.on('data', cb(data))` - An event emitted when the generator yields a value that can't be thunkifyered
- `co.on('done', cb(res))` - An event emitted when the generator returns
- `co.on('error', cb(err))` - An event emitted when the generator throws an error
- `co.pullStream` - A pull-stream for the data

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