# regenerator

> Source transformer enabling ECMAScript 6 generator functions (yield) in JavaScript-of-today (ES5)

Latest version **0.14.12** (published 2023-12-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install regenerator
pnpm add regenerator
yarn add regenerator
bun add regenerator
```

Provides the command `regenerator`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.14.12 |
| Published | 2023-12-15 |
| First published | 2013-10-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.6 |
| Dependencies | 9 |
| Unpacked size | 16.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Ben Newman |
| Maintainers | benjamn |
| Keywords | generator, yield, coroutine, rewriting, transformation, syntax, codegen, rewriting, refactoring, transpiler, desugaring, ES6 |

## Links

- npm: https://www.npmjs.com/package/regenerator
- Repository: https://github.com/facebook/regenerator
- Homepage: http://github.com/facebook/regenerator
- Issues: https://github.com/facebook/regenerator/issues
- npm.io page: https://npm.io/package/regenerator

## Dependencies (9)

- [recast](https://npm.io/package/recast.md) ^0.23.3
- [through](https://npm.io/package/through.md) ^2.3.8
- [commoner](https://npm.io/package/commoner.md) ^0.10.8
- [@babel/core](https://npm.io/package/@babel/core.md) ^7.8.4
- [@babel/types](https://npm.io/package/@babel/types.md) ^7.8.3
- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.8.4
- [regenerator-preset](https://npm.io/package/regenerator-preset.md) ^0.14.1
- [regenerator-runtime](https://npm.io/package/regenerator-runtime.md) ^0.14.1
- [regenerator-transform](https://npm.io/package/regenerator-transform.md) ^0.15.2

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.14.12 (latest) — 2023-12-15
- 0.14.11 — 2023-08-04
- 0.14.10 — 2022-11-14
- 0.14.9 — 2022-10-17
- 0.14.8 — 2022-10-13
- 0.14.7 — 2020-07-22
- 0.14.6 — 2020-07-21
- 0.14.5 — 2020-06-30
- 0.14.4 — 2020-03-12
- 0.14.3 — 2020-02-23
- 0.14.2 — 2019-07-19
- 0.14.1 — 2019-05-01
- 0.14.0 — 2019-04-30
- 0.13.4 — 2019-03-07
- 0.13.3 — 2018-11-16
- … 134 more at https://npm.io/package/regenerator/versions

## README

regenerator [![Build Status](https://travis-ci.org/facebook/regenerator.svg?branch=master)](https://travis-ci.org/facebook/regenerator)
===

This package implements a fully-functional source transformation that
takes the syntax for generators/`yield` from [ECMAScript 2015 or ES2015](http://www.ecma-international.org/ecma-262/6.0/) and [Asynchronous Iteration](https://github.com/tc39/proposal-async-iteration) proposal and
spits out efficient JS-of-today (ES5) that behaves the same way.

A small runtime library (less than 1KB compressed) is required to provide the
`wrapGenerator` function. You can install it either as a CommonJS module
or as a standalone .js file, whichever you prefer.

Installation
---

From npm:
```sh
npm install -g regenerator
```

From GitHub:
```sh
cd path/to/node_modules
git clone git://github.com/facebook/regenerator.git
cd regenerator
npm install .
npm test
```

Usage
---

You have several options for using this module.

Simplest usage:
```sh
regenerator es6.js > es5.js # Just the transform.
regenerator --include-runtime es6.js > es5.js # Add the runtime too.
regenerator src lib # Transform every .js file in src and output to lib.
```

Programmatic usage:
```js
var es5Source = require("regenerator").compile(es6Source).code;
var es5SourceWithRuntime = require("regenerator").compile(es6Source, {
  includeRuntime: true
}).code;
```

AST transformation:
```js
var recast = require("recast");
var ast = recast.parse(es6Source);
ast = require("regenerator").transform(ast);
var es5Source = recast.print(ast);
```

How can you get involved?
---

The easiest way to get involved is to look for buggy examples using [the
sandbox](http://facebook.github.io/regenerator/), and when you find
something strange just click the "report a bug" link (the new issue form
will be populated automatically with the problematic code).

Alternatively, you can
[fork](https://github.com/facebook/regenerator/fork) the repository,
create some failing tests cases in [test/tests.es6.js](test/tests.es6.js),
and send pull requests for me to fix.

If you're feeling especially brave, you are more than welcome to dive into
the transformer code and fix the bug(s) yourself, but I must warn you that
the code could really benefit from [better implementation
comments](https://github.com/facebook/regenerator/issues/7).

---
_Source: https://npm.io/package/regenerator · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
