infracloud/scripts/node_modules/generator-function
2026-02-28 09:07:22 -03:00
..
.github docs: update infrastructure docs, connections and services inventory 2026-02-28 09:07:22 -03:00
test docs: update infrastructure docs, connections and services inventory 2026-02-28 09:07:22 -03:00
.eslintrc docs: update infrastructure docs, connections and services inventory 2026-02-28 09:07:22 -03:00
.nycrc docs: update infrastructure docs, connections and services inventory 2026-02-28 09:07:22 -03:00
CHANGELOG.md docs: update infrastructure docs, connections and services inventory 2026-02-28 09:07:22 -03:00
index.d.mts docs: update infrastructure docs, connections and services inventory 2026-02-28 09:07:22 -03:00
index.d.ts docs: update infrastructure docs, connections and services inventory 2026-02-28 09:07:22 -03:00
index.js docs: update infrastructure docs, connections and services inventory 2026-02-28 09:07:22 -03:00
index.mjs docs: update infrastructure docs, connections and services inventory 2026-02-28 09:07:22 -03:00
legacy.js docs: update infrastructure docs, connections and services inventory 2026-02-28 09:07:22 -03:00
LICENSE.md docs: update infrastructure docs, connections and services inventory 2026-02-28 09:07:22 -03:00
package.json docs: update infrastructure docs, connections and services inventory 2026-02-28 09:07:22 -03:00
README.md docs: update infrastructure docs, connections and services inventory 2026-02-28 09:07:22 -03:00
require.mjs docs: update infrastructure docs, connections and services inventory 2026-02-28 09:07:22 -03:00
tsconfig.json docs: update infrastructure docs, connections and services inventory 2026-02-28 09:07:22 -03:00

generator-function Version Badge

github actions coverage License Downloads

npm badge

A function that returns the normally hidden GeneratorFunction constructor, when available.

Getting started

npm install --save generator-function

Usage/Examples

const assert = require('assert');
const GeneratorFunction = require('generator-function')();

const fn = new GeneratorFunction('return 1');

assert.equal(fn.toString(), 'function* anonymous(\n) {\nreturn 1\n}');

const iterator = fn();

assert.deepEqual(iterator.next(), { done: true, value: 1 });

Tests

Clone the repo, npm install, and run npm test