https://github.com/idiocc/is-generator-function
[fork] Checks If The Function Is An ES6 Generator.
https://github.com/idiocc/is-generator-function
Last synced: 12 months ago
JSON representation
[fork] Checks If The Function Is An ES6 Generator.
- Host: GitHub
- URL: https://github.com/idiocc/is-generator-function
- Owner: idiocc
- License: other
- Created: 2019-04-19T03:38:42.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-07-19T20:41:39.000Z (almost 7 years ago)
- Last Synced: 2025-06-27T22:02:49.970Z (12 months ago)
- Language: JavaScript
- Homepage: https://idio.cc
- Size: 41 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# @goa/is-generator-function
[](https://npmjs.org/package/@goa/is-generator-function)
`@goa/is-generator-function` is a [fork](https://github.com/ljharb/is-generator-function) that Checks If The Function Is An ES6 Generator written in ES6 modules.
The original module has been updated to be used in [`@goa/koa`](https://artdecocode.com/goa/): _Koa_ web server compiled with _Google Closure Compiler_ using [**Depack**](https://artdecocode.com/depack/) into a single file library (0 dependencies).
```sh
yarn add @goa/is-generator-function
```
## Table Of Contents
- [Table Of Contents](#table-of-contents)
- [API](#api)
- [`isGeneratorFunction(fn: function): boolean`](#isgeneratorfunctionfn-function-boolean)
- [Copyright](#copyright)
## API
The package is available by importing its default function:
```js
import isGeneratorFunction from '@goa/is-generator-function'
```
## `isGeneratorFunction(`
`fn: function,`
`): boolean`
Checks if the function is a generator function.
```js
import isGeneratorFunction from '@goa/is-generator-function'
console.log(isGeneratorFunction(function * generator() {} ))
console.log(isGeneratorFunction({ * generator() {} }.generator))
console.log(isGeneratorFunction(() => console.log('example')))
```
```
true
true
false
```
## Copyright
Original Author: **Jordan Harband**
---
© Art Deco for Idio 2019
Tech Nation Visa Sucks