{"_id":"generator-function","_rev":"4085441","name":"generator-function","description":"A function that returns the normally hidden `GeneratorFunction` constructor","dist-tags":{"latest":"2.0.1"},"maintainers":[{"name":"ljharb","email":""},{"name":"timothygu","email":"timothygu99@gmail.com"}],"time":{"modified":"2025-12-01T22:14:36.000Z","created":"2015-10-11T05:37:08.176Z","2.0.1":"2025-09-30T18:23:33.207Z","2.0.0":"2025-09-29T15:29:17.691Z","1.0.0":"2015-10-11T05:37:08.176Z"},"users":{},"author":{"name":"Jordan Harbamd","email":"ljharb@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/TimothyGu/generator-function.git"},"versions":{"2.0.1":{"name":"generator-function","version":"2.0.1","description":"A function that returns the normally hidden `GeneratorFunction` constructor","main":"./legacy.js","jsnext:main":"./index.mjs","module":"./index.mjs","exports":{".":[{"module-sync":"./require.mjs","import":"./index.mjs","default":"./index.js"},"./index.js"],"./package.json":"./package.json"},"sideEffects":false,"scripts":{"prepack":"npmignore --auto --commentLines=autogenerated","prepublish":"not-in-publish || npm run prepublishOnly","prepublishOnly":"safe-publish-latest","pretest":"npm run --silent lint","test":"npm run tests-only","posttest":"npx npm@\">=10.2\" audit --production","tests-only":"nyc tape 'test/**/*.js'","prelint":"evalmd README.md","lint":"eslint --ext=js,mjs .","postlint":"tsc && attw -P","version":"auto-changelog && git add CHANGELOG.md","postversion":"auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""},"repository":{"type":"git","url":"git+https://github.com/TimothyGu/generator-function.git"},"keywords":["generator","function","native"],"author":{"name":"Jordan Harbamd","email":"ljharb@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/TimothyGu/generator-function/issues"},"homepage":"https://github.com/TimothyGu/generator-function#readme","devDependencies":{"@arethetypeswrong/cli":"^0.18.2","@ljharb/eslint-config":"^21.2.0","@ljharb/tsconfig":"^0.3.2","@types/semver":"^6.2.7","@types/tape":"^5.8.1","auto-changelog":"^2.5.0","encoding":"^0.1.13","eslint":"=8.8.0","evalmd":"^0.0.19","generator-function":"file:.","get-proto":"^1.0.1","in-publish":"^2.0.1","npmignore":"^0.3.1","nyc":"^10.3.2","safe-publish-latest":"^2.0.0","semver":"^6.3.1","tape":"^5.9.0","typescript":"next"},"engines":{"node":">= 0.4"},"auto-changelog":{"output":"CHANGELOG.md","template":"keepachangelog","unreleased":false,"commitLimit":false,"backfillLimit":false,"hideCredit":true},"publishConfig":{"ignore":[".github/workflows"]},"testling":{"files":"test/index.js"},"_id":"generator-function@2.0.1","gitHead":"e44c753dc1205a5a1cd45176acbcd139c8d68a7b","_nodeVersion":"24.8.0","_npmVersion":"11.6.0","dist":{"shasum":"0e75dd410d1243687a0ba2e951b94eedb8f737a2","size":4441,"noattachment":false,"key":"/generator-function/-/generator-function-2.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/generator-function/download/generator-function-2.0.1.tgz"},"_npmUser":{"name":"ljharb","email":"ljharb@gmail.com"},"directories":{},"maintainers":[{"name":"ljharb","email":""},{"name":"timothygu","email":"timothygu99@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/generator-function_2.0.1_1759256613000_0.7235255081930327"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2025-09-30T18:23:33.207Z","publish_time":1759256613207,"_source_registry_name":"default","_cnpm_publish_time":1759256613207},"2.0.0":{"name":"generator-function","version":"2.0.0","description":"A function that returns the normally hidden `GeneratorFunction` constructor","main":"./legacy.js","jsnext:main":"./index.mjs","module":"./index.mjs","exports":{".":[{"module-sync":"./require.mjs","import":"./index.mjs","default":"./index.js"},"./index.js"],"./package.json":"./package.json"},"sideEffects":false,"scripts":{"prepack":"npmignore --auto --commentLines=autogenerated","prepublish":"not-in-publish || npm run prepublishOnly","prepublishOnly":"safe-publish-latest","pretest":"npm run --silent lint","test":"npm run tests-only","posttest":"npx npm@\">=10.2\" audit --production","tests-only":"nyc tape 'test/**/*.js'","prelint":"evalmd README.md","lint":"eslint --ext=js,mjs .","postlint":"tsc && attw -P","version":"auto-changelog && git add CHANGELOG.md","postversion":"auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""},"repository":{"type":"git","url":"git+https://github.com/ljharb/generator-function.git"},"keywords":["generator","function","native"],"author":{"name":"Jordan Harbamd","email":"ljharb@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/ljharb/generator-function/issues"},"homepage":"https://github.com/ljharb/generator-function#readme","devDependencies":{"@arethetypeswrong/cli":"^0.18.2","@ljharb/eslint-config":"^21.2.0","@ljharb/tsconfig":"^0.3.2","@types/semver":"^6.2.7","@types/tape":"^5.8.1","auto-changelog":"^2.5.0","encoding":"^0.1.13","eslint":"=8.8.0","evalmd":"^0.0.19","generator-function":"file:.","get-proto":"^1.0.1","in-publish":"^2.0.1","npmignore":"^0.3.1","nyc":"^10.3.2","safe-publish-latest":"^2.0.0","semver":"^6.3.1","tape":"^5.9.0","typescript":"next"},"engines":{"node":">= 0.4"},"auto-changelog":{"output":"CHANGELOG.md","template":"keepachangelog","unreleased":false,"commitLimit":false,"backfillLimit":false,"hideCredit":true},"publishConfig":{"ignore":[".github/workflows"]},"testling":{"files":"test/index.js"},"_id":"generator-function@2.0.0","gitHead":"2695e9c2e0a4529d5f8fc2f1f2c8fb112e325e34","_nodeVersion":"24.8.0","_npmVersion":"11.6.0","dist":{"shasum":"f7d330dccf367a666195948580655946d1a3860a","size":4384,"noattachment":false,"key":"/generator-function/-/generator-function-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/generator-function/download/generator-function-2.0.0.tgz"},"_npmUser":{"name":"ljharb","email":"ljharb@gmail.com"},"directories":{},"maintainers":[{"name":"ljharb","email":""},{"name":"timothygu","email":"timothygu99@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/generator-function_2.0.0_1759159757498_0.84355731237888"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2025-09-29T15:29:17.691Z","publish_time":1759159757691,"_source_registry_name":"default","_cnpm_publish_time":1759159757691},"1.0.0":{"name":"generator-function","version":"1.0.0","description":"Expose the GeneratorFunction constructor if supported by the runtime","main":"index.js","scripts":{"test":"node test"},"repository":{"type":"git","url":"git+https://github.com/timothygu/generator-function.git"},"keywords":["generators"],"author":{"name":"Timothy Gu","email":"timothygu99@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/timothygu/generator-function/issues"},"homepage":"https://github.com/timothygu/generator-function#readme","devDependencies":{"testit":"^2.0.2"},"gitHead":"176e0cd3a5ebb004aa666c6eecbe5a968efbddf9","_id":"generator-function@1.0.0","_shasum":"931e79b57b0544c7e0417e65c3764c90d8c8c25d","_from":".","_npmVersion":"2.14.4","_nodeVersion":"4.1.2","_npmUser":{"name":"timothygu","email":"timothygu99@gmail.com"},"dist":{"shasum":"931e79b57b0544c7e0417e65c3764c90d8c8c25d","size":2331,"noattachment":false,"key":"/generator-function/-/generator-function-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/generator-function/download/generator-function-1.0.0.tgz"},"maintainers":[{"name":"ljharb","email":""},{"name":"timothygu","email":"timothygu99@gmail.com"}],"directories":{},"_cnpmcore_publish_time":"2021-12-23T10:56:15.677Z","publish_time":1444541828176,"_cnpm_publish_time":1444541828176}},"readme":"# generator-function <sup>[![Version Badge][npm-version-svg]][package-url]</sup>\n\n[![github actions][actions-image]][actions-url]\n[![coverage][codecov-image]][codecov-url]\n[![License][license-image]][license-url]\n[![Downloads][downloads-image]][downloads-url]\n\n[![npm badge][npm-badge-png]][package-url]\n\nA function that returns the normally hidden `GeneratorFunction` constructor, when available.\n\n## Getting started\n\n```sh\nnpm install --save generator-function\n```\n\n## Usage/Examples\n\n```js\nconst assert = require('assert');\nconst GeneratorFunction = require('generator-function')();\n\nconst fn = new GeneratorFunction('return 1');\n\nassert.equal(fn.toString(), 'function* anonymous(\\n) {\\nreturn 1\\n}');\n\nconst iterator = fn();\n\nassert.deepEqual(iterator.next(), { done: true, value: 1 });\n```\n\n## Tests\n\nClone the repo, `npm install`, and run `npm test`\n\n[package-url]: https://npmjs.org/package/generator-function\n[npm-version-svg]: https://versionbadg.es/TimothyGu/generator-function.svg\n[deps-svg]: https://david-dm.org/TimothyGu/generator-function.svg\n[deps-url]: https://david-dm.org/TimothyGu/generator-function\n[dev-deps-svg]: https://david-dm.org/TimothyGu/generator-function/dev-status.svg\n[dev-deps-url]: https://david-dm.org/TimothyGu/generator-function#info=devDependencies\n[npm-badge-png]: https://nodei.co/npm/generator-function.png?downloads=true&stars=true\n[license-image]: https://img.shields.io/npm/l/generator-function.svg\n[license-url]: LICENSE\n[downloads-image]: https://img.shields.io/npm/dm/generator-function.svg\n[downloads-url]: https://npm-stat.com/charts.html?package=generator-function\n[codecov-image]: https://codecov.io/gh/TimothyGu/generator-function/branch/main/graphs/badge.svg\n[codecov-url]: https://app.codecov.io/gh/TimothyGu/generator-function/\n[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/TimothyGu/generator-function\n[actions-url]: https://github.com/TimothyGu/generator-function/actions\n","_attachments":{},"homepage":"https://github.com/TimothyGu/generator-function#readme","bugs":{"url":"https://github.com/TimothyGu/generator-function/issues"},"license":"MIT"}