async-generator-function
A function that returns the normally hidden `AsyncGeneratorFunction` constructor
Last updated a year ago by ljharb .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install async-generator-function 
SYNC missed versions from official npm registry.

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

Current Tags

  • 1.0.0                                ...           latest (a year ago)

1 Versions

  • 1.0.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (0)
None
Dev Dependencies (17)

Copyright 2013 - present © cnpmjs.org | Home |