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

Package detail

make-generator-function

ljharb14.4kMIT2.0.0TypeScript support: definitely-typed

Returns an arbitrary generator function, or undefined if generator syntax is unsupported.

generator function, ES6, generator, function*

readme

make-generator-function Version Badge

Build Status dependency status dev dependency status License Downloads

npm badge

browser support

Returns an arbitrary generator function, or undefined if generator syntax is unsupported. If both generator syntax and concise method syntax are supported, the generator function returned will have a "concise" property containing a concise generator method.

Example

var maybeGeneratorFunction = require('make-generator-function');
if (maybeGeneratorFunction) {
    assert(typeof maybeGeneratorFunction === 'function');
    var maybeConciseGeneratorMethod = maybeGeneratorFunction.concise;
    if (maybeConciseGeneratorMethod) {
        assert(typeof maybeConciseGeneratorMethod === 'function');
    }
} else {
    assert(typeof maybeGeneratorFunction === 'undefined');
}

Tests

Simply clone the repo, npm install, and run npm test

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

Generated by auto-changelog.

v2.0.0 - 2020-01-28

Commits

  • [Breaking] export a function that returns a list of generator functions 71003b9

v1.1.1 - 2020-01-27

Fixed

  • [Docs] Add missing license #2

Commits

  • [Tests] use shared travis-ci configs 73dba5c
  • Update eslint, tape; use my personal shared eslint config b604ab4
  • Add npm run eslint 113d983
  • [Tests] remove jscs 4c9100c
  • [Tests] up to node v8.4, v7.10, v6.11, v4.8; newer npm breaks on older node; improve matrix 865d46f
  • [Tests] up to node v11.7, v10.15, v9.11, v8.15, v6.16, v4.9 c159ff4
  • [Dev Deps] update tape, jscs, eslint, @ljharb/eslint-config, nsp 06336cc
  • [meta] add auto-changelog 672196a
  • [Tests] up to node v12.10, v11.15, v10.16, v8.16, v6.17 97c87a3
  • Update tape, jscs, covert 55a82c3
  • [Tests] up to node v6.2, v5.11, v4.4 e8dd157
  • [Tests] up to node v9.3, v8.9, v6.12; use nvm install-latest-npm; pin included builds to LTS 6b9aeda
  • Update eslint, nsp acc5699
  • [Tests] up to node v7.0, v6.9, v4.6; improve test matrix 6050544
  • Update tape, jscs, eslint, @ljharb/eslint-config 3a74514
  • [actions] add automatic rebasing / merge commit blocking 2b0632e
  • Test up to io.js v2.2 7be5eaa
  • [Dev Deps] update eslint, @ljharb/eslint-config, tape 89ca6b8
  • [Dev Deps] update eslint, @ljharb/eslint-config, tape; add safe-publish-latest 1085b97
  • [Dev Deps] update eslint, @ljharb/eslint-config, nsp, tape 31669dd
  • [Dev Deps] update tape, jscs, eslint, @ljharb/eslint-config, nsp 3e5632c
  • [Tests] up to io.js v3.3, node v4.1 ae10e71
  • [Dev Deps] update eslint, @ljharb/eslint-config, covert, tape 498a056
  • [Tests] use npm audit instead of nsp be8e5d2
  • Only apps should have lockfiles 2be2319
  • [Dev Deps] update jscs, eslint, @ljharb/eslint-config, nsp 54be59e
  • [Dev Deps] update jscs 5248429
  • [Tests] use npx aud instead of nsp or npm audit with hoops 3b01ae8
  • [Dev Deps] update eslint, @ljharb/eslint-config, nsp 94dc41a
  • [Dev Deps] update tape, eslint, @ljharb/eslint-config 5e371bf
  • [Tests] use pretest/posttest for linting/security; create tests-only script. d5794fa
  • [Tests] use eclint instead of editorconfig-tools eed2fad
  • [Dev Deps] update nsp, eslint 43665f5
  • [Tests] up to node v7.2 0386a7b
  • [Dev Deps] Update tape, eslint 5810537
  • Test on iojs-v1.5 and iojs-v1.6 9553cf1
  • Update editorconfig-tools, nsp 9c1584a
  • [meta] add funding field 293f453
  • node supports generators now. ace0d4b
  • Test up to io.jsv3.0[5b2df35`](https://github.com/ljharb/make-generator-function/commit/5b2df35a95c2bf60bad3b1ff1f44078e9bc0a072)
  • Removing unused devDependencies. f72daba
  • [Dev Deps] update tape c357966
  • Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG. 7607415
  • Test on io.js v2.4 ca61c17
  • Test on io.js v2.3 5b029ba

v1.1.0 - 2015-03-03

Commits

  • Add a concise generator method. ea86f3d
  • All grade A-supported node/iojs versions now ship with an npm that understands ^. 62630da
  • Reorganizing tests. f77c0cd
  • Update is, tape, jscs, nsp 40c85a2
  • Run travis-ci tests on iojs and node v0.12; speed up builds; allow 0.8 failures. 2f20edc
  • Test on latest io.js 0eac7b6
  • Update tape, jscs dab3942
  • Update jscs f9cfafb
  • Don't run eccheck as part of tests yet. c8fe96d
  • Test on iojs-v1.2 b188157

v1.0.0 - 2014-12-15

Commits