tree: d39fecd3b48f96c01f61ccc926a651e1f8e4f564 [path history] [tgz]
  1. .github/
  2. test/
  3. .eslintrc
  4. .nycrc
  5. CHANGELOG.md
  6. index.d.mts
  7. index.d.ts
  8. index.js
  9. index.mjs
  10. legacy.js
  11. LICENSE
  12. package.json
  13. README.md
  14. require.mjs
  15. tsconfig.json
node_modules/async-function/README.md

async-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-function

Usage/Examples

const assert = require('assert');
const AsyncFunction = require('async-function')();

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

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

fn().then(x => {
    assert.equal(x, 1);
});

Tests

Clone the repo, npm install, and run npm test