An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

README

          

# @goa/is-generator-function

[![npm version](https://badge.fury.io/js/%40goa%2Fis-generator-function.svg)](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


© Art Deco for Idio 2019


Idio




Tech Nation Visa


Tech Nation Visa Sucks