Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@babel/plugin-transform-async-to-generator

Package Overview
Dependencies
Maintainers
6
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/plugin-transform-async-to-generator

Turn async functions into ES2015 generators

  • 7.0.0-beta.44
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
19M
decreased by-26.09%
Maintainers
6
Weekly downloads
 
Created

What is @babel/plugin-transform-async-to-generator?

The @babel/plugin-transform-async-to-generator package is a Babel plugin that transforms async functions into generator functions using the regenerator runtime, which is a part of the Facebook Regenerator project. This transformation allows async functions to be used in environments that do not natively support async/await syntax by converting them into ES2015/ES6 compatible code.

What are @babel/plugin-transform-async-to-generator's main functionalities?

Transform async functions to generators

This feature allows developers to write asynchronous code using the modern async/await syntax and have it transformed into generator functions that are compatible with older JavaScript engines.

async function foo() {
  await bar();
}
// Transforms to:
function foo() {
  return regeneratorRuntime.async(function foo$(_context) {
    while (1) {
      switch (_context.prev = _context.next) {
        case 0:
          _context.next = 2;
          return regeneratorRuntime.awrap(bar());
        case 2:
        case "end":
          return _context.stop();
      }
    }
  }, null, this);
}

Other packages similar to @babel/plugin-transform-async-to-generator

Keywords

FAQs

Package last updated on 02 Apr 2018

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc