Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

is-genfn

ninegrid15MIT0.1.0

validate an es6 generator function

es6, harmony, generators, validate

readme

is-genfn

Validate an es6 generator function.

'use strict'
var bint = require('bignum'),
    isGfn = require('is-genfn');

// nifty
var fib = function*(){
  let x = bint(0), y = bint(1), z = bint(0);
  while(true){
    z = x.add(y);
    x = y;
    y = z;
    yield y;
  }
};

// yes
console.log("Is it a generator function? " + isGFn(fib);

// no
console.log("Is it a generator function? " + isGFn(fib());