You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
![]() |
1 week ago | |
---|---|---|
.. | ||
.github | 1 week ago | |
test | 1 week ago | |
.eslintrc | 1 week ago | |
.nycrc | 1 week ago | |
CHANGELOG.md | 1 week ago | |
LICENSE | 1 week ago | |
README.md | 1 week ago | |
index.d.mts | 1 week ago | |
index.d.ts | 1 week ago | |
index.js | 1 week ago | |
index.mjs | 1 week ago | |
legacy.js | 1 week ago | |
package.json | 1 week ago | |
require.mjs | 1 week ago | |
tsconfig.json | 1 week ago |
README.md
async-function 
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