This repository has been archived by the owner. It is now read-only.
A simple library to turn javascript generators into promise-returning functions
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
.jshintrc
LICENSE
README.md
index.js
package.json bump version for new test changes, and make tweaks to package.json Feb 16, 2016
tests.js

README.md

Async and Await are in stable versions of node! Use that instead!

roads-coroutine

A simple library to turn javascript generators into promise-returning functions.

Examples

var cr = require('roads-coroutine');

var fn = cr(function* (param) {
  var result = yield promiseReturningAsyncFunction(param);
  return "final result: " + result;
});

fn('hey!').then(function (response) {
  console.log(response);
}, function (err) {
  console.log(response);
});

The tests have even more examples!

Warning

There are versions of iojs pre-2.5.0 that can generate false "unhandled rejection" events. Please make sure you are using at least 2.5.0