Socket
Socket
Sign inDemoInstall

babel-plugin-transform-regenerator

Package Overview
Dependencies
Maintainers
5
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-transform-regenerator

Explode async and generator functions into a state machine.


Version published
Weekly downloads
1.5M
decreased by-0.81%
Maintainers
5
Weekly downloads
 
Created

What is babel-plugin-transform-regenerator?

The babel-plugin-transform-regenerator npm package is used to transform ES2015+ generator functions into ES5 code. This is particularly useful for writing asynchronous code in a synchronous manner using the `yield` keyword, and for ensuring compatibility with older browsers or environments that do not support generator functions natively.

What are babel-plugin-transform-regenerator's main functionalities?

Transformation of generator functions

This feature allows developers to write generator functions using the `function*` syntax and `yield` keyword. The babel-plugin-transform-regenerator will then transform this into ES5 compatible code, enabling the use of generator functions in environments that do not support them natively.

function* gen() { yield 'Hello'; yield 'World'; }

Async/Await support

Although primarily focused on generator functions, babel-plugin-transform-regenerator also plays a crucial role in enabling the use of async/await syntax in projects that use Babel for transpilation. It transforms async functions into generator functions and then into ES5 code.

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

Other packages similar to babel-plugin-transform-regenerator

FAQs

Package last updated on 16 Aug 2017

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