# comise

> Promises + Co

Latest version **1.0.1** (published 2016-03-31) · MIT license · 0 weekly downloads

## Install

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

## 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.1 |
| Published | 2016-03-31 |
| First published | 2016-03-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | John Hofrichter |
| Maintainers | johnhof |
| Keywords | co, promise, comise, generator |

## Links

- npm: https://www.npmjs.com/package/comise
- Repository: https://github.com/johnhof/comise
- Homepage: https://github.com/johnhof/comise#readme
- Issues: https://github.com/johnhof/comise/issues
- npm.io page: https://npm.io/package/comise

## Dependencies (1)

- [co](https://npm.io/package/co.md) ^4.6.0

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [jwt-simple](https://npm.io/package/jwt-simple.md) — 259.5K weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2016-03-31
- 1.0.0 — 2016-03-17
- 0.0.1 — 2016-03-17

## README

# comise

[![Build Status](https://travis-ci.org/johnhof/comise.svg?branch=master)](https://travis-ci.org/johnhof/comise)

Promises + Co

# Usage

### Simple

```javascript
let co = require('co');
let comise = require('comise');

co(function *() {
  let result = yield comise(function *() {
    return 'It worked!';
  });

  console.log(result); // It worked!
});
```

### Context Binding

```javascript
'use strict';

let co = require('co');
let comise = require('../lib/comise');

class Foo {
  bar() {
    return comise(function *() {
      let work = yield this.work();
      return 'Did ' + work + ' Work';
    }, this);
  }

  work() {
    return comise(function *() {
      let i = 0;
      for (i = 0; i < 1000; i++) {}
      return i;
    }, this);
  }
}

co(function *() {
  let foo = new Foo();
  let result = yield foo.bar();
  console.log(result); // Did 1000 Work
}).catch((err) => { console.log(err); });
```

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