This package has been deprecated
Author message:
this package has been deprecated
roads-coroutine
1.1.1 • Public • Published 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
Package Sidebar
Install
Weekly Downloads