# babel-plugin-transform-function-sent2

> Compile the function.sent meta propety to valid ES2015 code

Latest version **7.0.0-alpha.16** (published 2017-07-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install babel-plugin-transform-function-sent2
pnpm add babel-plugin-transform-function-sent2
yarn add babel-plugin-transform-function-sent2
bun add babel-plugin-transform-function-sent2
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: no vulnerabilities; high maintenance score; popular repo.

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

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 7.0.0-alpha.16 |
| Published | 2017-07-25 |
| First published | 2017-07-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 43999 |
| Maintainers | hzoo |
| Keywords | babel-plugin |

## Links

- npm: https://www.npmjs.com/package/babel-plugin-transform-function-sent2
- Repository: https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-function-sent
- npm.io page: https://npm.io/package/babel-plugin-transform-function-sent2

## Dependencies (2)

- [babel-helper-wrap-function](https://npm.io/package/babel-helper-wrap-function.md) 7.0.0-alpha.16
- [babel-plugin-syntax-function-sent](https://npm.io/package/babel-plugin-syntax-function-sent.md) 7.0.0-alpha.16

## 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

- 7.0.0-alpha.16 (latest) — 2017-07-25
- 7.0.0-alpha.17 (next) — 2017-07-26

## README

# babel-plugin-transform-function-sent2

> Publishing as 2 until we get the package
> Compile the `function.sent` meta property, used inside generator functions, to valid ES2015 code.

## Example

```js
function* generator() {
    console.log("Sent", function.sent);
    console.log("Yield", yield);
}

const iterator = generator();
iterator.next(1); // Logs "Sent 1"
iterator.next(2); // Logs "Yield 2"
```

Is compiled roughly to

```js
let generator = _skipFirstGeneratorNext(function* () {
    const _functionSent = yield;
    console.log("Sent", _functionSent);
    console.log("Yield", yield);
});

const iterator = generator();
iterator.next(1); // Logs "Sent 1"
iterator.next(2); // Logs "Yield 1"
```

## Installation

```sh
npm install --save-dev babel-plugin-transform-function-sent
```

## Usage

### Via `.babelrc` (Recommended)

**.babelrc**

```json
{
  "plugins": ["transform-function-sent"]
}
```

### Via CLI

```sh
babel --plugins transform-function-sent script.js
```

### Via Node API

```javascript
require("babel-core").transform("code", {
  plugins: ["transform-function-sent"]
});
```

## References

* [Proposal](https://github.com/allenwb/ESideas/blob/master/Generator%20metaproperty.md)

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