# is-generator-function

> Determine if a function is a native generator function.

Latest version **1.1.2** (published 2025-09-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install is-generator-function
pnpm add is-generator-function
yarn add is-generator-function
bun add is-generator-function
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2025-09-30 |
| First published | 2014-02-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >= 0.4 |
| Dependencies | 5 |
| Unpacked size | 35.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 48 |
| Author | Jordan Harband |
| Maintainers | ljharb |
| Keywords | generator, generator function, es6, es2015, yield, function, function* |

## Links

- npm: https://www.npmjs.com/package/is-generator-function
- Repository: https://github.com/inspect-js/is-generator-function
- Homepage: https://github.com/inspect-js/is-generator-function#readme
- Issues: https://github.com/inspect-js/is-generator-function/issues
- Funding: https://github.com/sponsors/ljharb
- npm.io page: https://npm.io/package/is-generator-function

## Dependencies (5)

- [get-proto](https://npm.io/package/get-proto.md) ^1.0.1
- [call-bound](https://npm.io/package/call-bound.md) ^1.0.4
- [has-tostringtag](https://npm.io/package/has-tostringtag.md) ^1.0.2
- [safe-regex-test](https://npm.io/package/safe-regex-test.md) ^1.1.0
- [generator-function](https://npm.io/package/generator-function.md) ^2.0.0

## Recent versions

- 1.1.2 (latest) — 2025-09-30
- 1.0.4 (backport) — 2016-12-20
- 1.1.1 — 2025-09-29
- 1.1.0 — 2025-01-02
- 1.0.10 — 2021-08-06
- 1.0.9 — 2021-05-06
- 1.0.8 — 2020-12-02
- 1.0.7 — 2017-12-28
- 1.0.6 — 2016-12-20
- 1.0.5 — 2016-12-20
- 1.0.3 — 2015-01-31
- 1.0.2 — 2015-01-20
- 1.0.1 — 2014-12-15
- 1.0.0 — 2014-08-09
- 0.0.0 — 2014-02-10

## README

# is-generator-function <sup>[![Version Badge][2]][1]</sup>

[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![dependency status][5]][6]
[![dev dependency status][7]][8]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]

[![npm badge][11]][1]

Is this a native generator function?

## Example

```js
var isGeneratorFunction = require('is-generator-function');
assert(!isGeneratorFunction(function () {}));
assert(!isGeneratorFunction(null));
assert(isGeneratorFunction(function* () { yield 42; return Infinity; }));
```

## Tests
Simply clone the repo, `npm install`, and run `npm test`

[1]: https://npmjs.org/package/is-generator-function
[2]: https://versionbadg.es/inspect-js/is-generator-function.svg
[5]: https://david-dm.org/inspect-js/is-generator-function.svg
[6]: https://david-dm.org/inspect-js/is-generator-function
[7]: https://david-dm.org/inspect-js/is-generator-function/dev-status.svg
[8]: https://david-dm.org/inspect-js/is-generator-function#info=devDependencies
[11]: https://nodei.co/npm/is-generator-function.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/is-generator-function.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/is-generator-function.svg
[downloads-url]: https://npm-stat.com/charts.html?package=is-generator-function
[codecov-image]: https://codecov.io/gh/inspect-js/is-generator-function/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/inspect-js/is-generator-function/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-generator-function
[actions-url]: https://github.com/inspect-js/is-generator-function/actions

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