Socket
Socket
Sign inDemoInstall

babel-plugin-transform-async-to-generator

Package Overview
Dependencies
29
Maintainers
6
Versions
41
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    babel-plugin-transform-async-to-generator

Turn async functions into ES2015 generators


Version published
Weekly downloads
1.2M
increased by3.98%
Maintainers
6
Install size
4.37 MB
Created
Weekly downloads
 

Readme

Source

babel-plugin-transform-async-to-generator

Turn async functions into ES2015 generators

Example

In

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

Out

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

Installation

npm install --save-dev babel-plugin-transform-async-to-generator

Usage

.babelrc

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

Via CLI

babel --plugins transform-async-to-generator script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["transform-async-to-generator"]
});

References

  • Proposal: Async Functions for ECMAScript

Keywords

FAQs

Last updated on 07 Apr 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc