Async to generator transform

Example

In

async function foo() {
  await bar();
}

Out

var _asyncToGenerator = function (fn) {
  ...
};
var foo = _asyncToGenerator(function* () {
  yield bar();
});

Installation

$ npm install babel-plugin-transform-async-to-generator

Usage

Add the following line to your .babelrc file:

{
  "plugins": ["transform-async-to-generator"]
}

References