# get-generator

> Get the value of a generator function.

Latest version **1.0.0** (published 2020-03-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install get-generator
pnpm add get-generator
yarn add get-generator
bun add get-generator
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2020-03-31 |
| First published | 2020-03-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=10 |
| Dependencies | 1 |
| Unpacked size | 3.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Richie Bendall |
| Maintainers | richienb |
| Keywords | generator, value, function, async, get |

## Links

- npm: https://www.npmjs.com/package/get-generator
- Repository: https://github.com/Richienb/get-generator
- npm.io page: https://npm.io/package/get-generator

## Dependencies (1)

- [@sindresorhus/is](https://npm.io/package/@sindresorhus/is.md) ^2.1.0

## Alternatives

- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads
- [fa](https://npm.io/package/fa.md) — 185 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2020-03-31

## README

# get-generator [![Travis CI Build Status](https://img.shields.io/travis/com/Richienb/get-generator/master.svg?style=for-the-badge)](https://travis-ci.com/Richienb/get-generator)

Get the value of a generator function.

[![NPM Badge](https://nodei.co/npm/get-generator.png)](https://npmjs.com/package/get-generator)

## Install

```sh
npm install get-generator
```

## Usage

```js
const getGenerator = require("get-generator");

function* generator() {
	yield 1;
	yield 2;
	yield 3;
}

getGenerator(generator());
//=> [1, 2, 3]

getGenerator(generator(), 2);
//=> [1, 2]
```

## API

### getGenerator(generator)
### getGenerator.async(generator)

#### generator

Type: `generator` or `async generator`

The generator to get the value of. Asynchronous generators are only supported by `getGenerator.async` which returns a promise.

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