babel-plugin-transform-async-to-module-method
babel-plugin-transform-async-to-module-method
npm i babel-plugin-transform-async-to-module-method
babel-plugin-transform-async-to-module-method

babel-plugin-transform-async-to-module-method

🐠 Babel is a compiler for writing next generation JavaScript.

by babel

6.24.1 (see all)License:MITTypeScript:Not Found
npm i babel-plugin-transform-async-to-module-method
Readme

babel-plugin-transform-async-to-module-method

Turn async functions into a Bluebird coroutine

Example

In

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

Out

var Bluebird = require("bluebird");

var foo = Bluebird.coroutine(function* () {
  yield bar();
});

Installation

npm install --save-dev babel-plugin-transform-async-to-module-method

Usage

.babelrc

Without options:

{
  "plugins": ["transform-async-to-module-method"]
}

With options:

{
  "plugins": [
    ["transform-async-to-module-method", {
      "module": "bluebird",
      "method": "coroutine"
    }]
  ]
}

Via CLI

babel --plugins transform-async-to-module-method script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["transform-async-to-module-method"]
});
VersionTagPublished
6.24.1
latest
6yrs ago
7.0.0-beta.3
next
5yrs ago
No alternatives found
No tutorials found
Add a tutorial
No dependencies found

Rate & Review

100
No reviews found
Be the first to rate