viabiliza/node_modules/async-generator-function
equipe desenvolvimento a499796cf7 first commit
2025-10-15 15:07:36 -03:00
..
.github first commit 2025-10-15 15:07:36 -03:00
test first commit 2025-10-15 15:07:36 -03:00
.eslintrc first commit 2025-10-15 15:07:36 -03:00
.nycrc first commit 2025-10-15 15:07:36 -03:00
CHANGELOG.md first commit 2025-10-15 15:07:36 -03:00
index.d.mts first commit 2025-10-15 15:07:36 -03:00
index.d.ts first commit 2025-10-15 15:07:36 -03:00
index.js first commit 2025-10-15 15:07:36 -03:00
index.mjs first commit 2025-10-15 15:07:36 -03:00
legacy.js first commit 2025-10-15 15:07:36 -03:00
LICENSE first commit 2025-10-15 15:07:36 -03:00
package.json first commit 2025-10-15 15:07:36 -03:00
README.md first commit 2025-10-15 15:07:36 -03:00
require.mjs first commit 2025-10-15 15:07:36 -03:00
tsconfig.json first commit 2025-10-15 15:07:36 -03:00

async-generator-function Version Badge

github actions coverage License Downloads

npm badge

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

Getting started

npm install --save async-generator-function

Usage/Examples

const assert = require('assert');
const AsyncGeneratorFunction = require('async-generator-function')();

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

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

const iterator = fn();
iterator.next().then(x => {
    assert.deepEqual(x, { done: true, value: 1 });
});

Tests

Clone the repo, npm install, and run npm test