Turn async functions into a Bluebird coroutine
$ npm install babel-plugin-transform-async-to-module-method
.babelrc
// without options
{
"plugins": ["transform-async-to-module-method"]
}
// with options
{
"plugins": [
["transform-async-to-module-method", {
"module": "bluebird",
"method": "coroutine"
}]
]
}
$ babel --plugins transform-async-to-module-method script.js
require("babel-core").transform("code", {
plugins: ["transform-async-to-module-method"]
});