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
5
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 - npm Package Compare versions

Comparing version 7.0.0-beta.49 to 7.0.0-beta.50

12

package.json
{
"name": "@babel/plugin-transform-async-to-generator",
"version": "7.0.0-beta.49",
"version": "7.0.0-beta.50",
"description": "Turn async functions into ES2015 generators",

@@ -12,5 +12,5 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-async-to-generator",

"dependencies": {
"@babel/helper-module-imports": "7.0.0-beta.49",
"@babel/helper-plugin-utils": "7.0.0-beta.49",
"@babel/helper-remap-async-to-generator": "7.0.0-beta.49"
"@babel/helper-module-imports": "7.0.0-beta.50",
"@babel/helper-plugin-utils": "7.0.0-beta.50",
"@babel/helper-remap-async-to-generator": "7.0.0-beta.50"
},

@@ -21,5 +21,5 @@ "peerDependencies": {

"devDependencies": {
"@babel/core": "7.0.0-beta.49",
"@babel/helper-plugin-test-runner": "7.0.0-beta.49"
"@babel/core": "7.0.0-beta.50",
"@babel/helper-plugin-test-runner": "7.0.0-beta.50"
}
}

@@ -5,86 +5,16 @@ # @babel/plugin-transform-async-to-generator

> In Babel 7, `transform-async-to-module-method` was merged into this plugin
See our website [@babel/plugin-transform-async-to-generator](https://new.babeljs.io/docs/en/next/babel-plugin-transform-async-to-generator.html) for more information.
## Example
## Install
**In**
Using npm:
```javascript
async function foo() {
await bar();
}
```
**Out**
```javascript
var _asyncToGenerator = function (fn) {
...
};
var foo = _asyncToGenerator(function* () {
yield bar();
});
```
**Out with options**
> Turn async functions into a Bluebird coroutine
```javascript
var Bluebird = require("bluebird");
var foo = Bluebird.coroutine(function* () {
yield bar();
});
```
## Installation
```sh
npm install --save-dev @babel/plugin-transform-async-to-generator
npm install --save @babel/plugin-transform-async-to-generator
```
## Usage
or using yarn:
### Via `.babelrc` (Recommended)
**.babelrc**
Without options:
```json
{
"plugins": ["@babel/plugin-transform-async-to-generator"]
}
```
With options:
```json
{
"plugins": [
["@babel/plugin-transform-async-to-generator", {
"module": "bluebird",
"method": "coroutine"
}]
]
}
```
### Via CLI
```sh
babel --plugins @babel/plugin-transform-async-to-generator script.js
yarn add --save @babel/plugin-transform-async-to-generator
```
### Via Node API
```javascript
require("@babel/core").transform("code", {
plugins: ["@babel/plugin-transform-async-to-generator"]
});
```
## References
* [Proposal: Async Functions for ECMAScript](https://github.com/tc39/ecmascript-asyncawait)
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