regenerator

How to use the regenerator transformer.

The regenerator transformer uses the regenerator module to transform async and generator functions.

Runtime required

You need to use either the Babel polyfill or the regenerator runtime.

Async functions

These are only usable if you enable experimental support. See experimental usage for information.

Example

In

function* foo() {
  yield 1;
}

Out

var foo = regeneratorRuntime.mark(function foo() {
  return regeneratorRuntime.wrap(function foo$(context$1$0) {
    while (1) switch (context$1$0.prev = context$1$0.next) {
      case 0:
        context$1$0.next = 2;
        return 1;

      case 2:
      case "end":
        return context$1$0.stop();
    }
  }, foo, this);
});