mirror-rhinstaller-node-cache/generator-function
2026-09-28 07:03:59 +00:00
..
test 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
.eslintrc 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
.nycrc 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
CHANGELOG.md 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
index.d.mts 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
index.d.ts 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
index.js 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
index.mjs 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
legacy.js 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
LICENSE.md 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
package.json 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
README.md 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
require.mjs 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
tsconfig.json 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00: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