{"_id":"async-generator-function","_rev":"4131028","name":"async-generator-function","description":"A function that returns the normally hidden `AsyncGeneratorFunction` constructor","dist-tags":{"latest":"1.0.0"},"maintainers":[{"name":"ljharb","email":""}],"time":{"modified":"2026-03-01T18:33:29.000Z","created":"2025-02-14T18:35:17.106Z","1.0.0":"2025-02-14T18:35:17.106Z"},"users":{},"author":{"name":"Jordan Harbamd","email":"ljharb@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/ljharb/async-generator-function.git"},"versions":{"1.0.0":{"name":"async-generator-function","version":"1.0.0","description":"A function that returns the normally hidden `AsyncGeneratorFunction` 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"},"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/async-generator-function.git"},"keywords":["async","await","function","native"],"author":{"name":"Jordan Harbamd","email":"ljharb@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/ljharb/async-generator-function/issues"},"homepage":"https://github.com/ljharb/async-generator-function#readme","devDependencies":{"@arethetypeswrong/cli":"^0.17.3","@ljharb/eslint-config":"^21.1.1","@ljharb/tsconfig":"^0.2.3","@types/semver":"^6.2.7","@types/tape":"^5.8.1","async-function":"^1.0.0","auto-changelog":"^2.5.0","eslint":"=8.8.0","evalmd":"^0.0.19","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":"async-generator-function@1.0.0","gitHead":"1a9f102c6794a234a6f9546c30704603e9fed2ea","_nodeVersion":"23.6.1","_npmVersion":"10.9.2","dist":{"shasum":"9bcc76d7fd147171e7ead5d2a2cfc3579c99f28e","size":4504,"noattachment":false,"key":"/async-generator-function/-/async-generator-function-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/async-generator-function/download/async-generator-function-1.0.0.tgz"},"_npmUser":{"name":"ljharb","email":"ljharb@gmail.com"},"directories":{},"maintainers":[{"name":"ljharb","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/async-generator-function_1.0.0_1739558116838_0.8301379473805939"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2025-02-14T18:35:17.106Z","publish_time":1739558117106,"_source_registry_name":"default","_cnpm_publish_time":1739558117106}},"readme":"# async-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 `AsyncFunction` constructor, when available.\n\n## Getting started\n\n```sh\nnpm install --save async-generator-function\n```\n\n## Usage/Examples\n\n```js\nconst assert = require('assert');\nconst AsyncGeneratorFunction = require('async-generator-function')();\n\nconst fn = new AsyncGeneratorFunction('return 1');\n\nassert.equal(fn.toString(), 'async function* anonymous(\\n) {\\nreturn 1\\n}');\n\nconst iterator = fn();\niterator.next().then(x => {\n    assert.deepEqual(x, { done: true, value: 1 });\n});\n```\n\n## Tests\n\nClone the repo, `npm install`, and run `npm test`\n\n[package-url]: https://npmjs.org/package/async-generator-function\n[npm-version-svg]: https://versionbadg.es/ljharb/async-generator-function.svg\n[deps-svg]: https://david-dm.org/ljharb/async-generator-function.svg\n[deps-url]: https://david-dm.org/ljharb/async-generator-function\n[dev-deps-svg]: https://david-dm.org/ljharb/async-generator-function/dev-status.svg\n[dev-deps-url]: https://david-dm.org/ljharb/async-generator-function#info=devDependencies\n[npm-badge-png]: https://nodei.co/npm/async-generator-function.png?downloads=true&stars=true\n[license-image]: https://img.shields.io/npm/l/async-generator-function.svg\n[license-url]: LICENSE\n[downloads-image]: https://img.shields.io/npm/dm/async-generator-function.svg\n[downloads-url]: https://npm-stat.com/charts.html?package=async-generator-function\n[codecov-image]: https://codecov.io/gh/ljharb/async-generator-function/branch/main/graphs/badge.svg\n[codecov-url]: https://app.codecov.io/gh/ljharb/async-generator-function/\n[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/async-generator-function\n[actions-url]: https://github.com/ljharb/async-generator-function/actions\n","_attachments":{},"homepage":"https://github.com/ljharb/async-generator-function#readme","bugs":{"url":"https://github.com/ljharb/async-generator-function/issues"},"license":"MIT"}