Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

async-generator-function

ljharb1MIT1.0.0TypeScript support: included

A function that returns the normally hidden AsyncGeneratorFunction constructor

async, await, function, native

readme

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

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

v1.0.0 - 2025-02-14

Commits