You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
724 B

4 years ago
  1. # regenerator-transform
  2. Transform async/generator functions with [regenerator](https://github.com/facebook/regenerator)
  3. ## Installation
  4. ```sh
  5. $ npm install regenerator-transform
  6. ```
  7. ## Usage
  8. ### Via `.babelrc` (Recommended)
  9. **.babelrc**
  10. ```js
  11. // without options
  12. {
  13. "plugins": ["regenerator-transform"]
  14. }
  15. // with options
  16. {
  17. "plugins": [
  18. ["regenerator-transform", {
  19. asyncGenerators: false, // true by default
  20. generators: false, // true by default
  21. async: false // true by default
  22. }]
  23. ]
  24. }
  25. ```
  26. ### Via CLI
  27. ```sh
  28. $ babel --plugins regenerator-transform script.js
  29. ```
  30. ### Via Node API
  31. ```javascript
  32. require("@babel/core").transformSync("code", {
  33. plugins: ["regenerator-transform"]
  34. });
  35. ```