asynccbn
Babel Plugin to transpile EcmaScript7 async function transpiled into callbacks.
![Coverage Status](https://img.shields.io/coveralls/thr0w/asynccbn.svg)
![NPM](https://nodei.co/npm/asynccbn.png?downloads=true)
still working, carefull in production enviroments
Why
Promises and generators need more memory and are slower then callbacks.
install
npm install asynccbn
usage
Use it as a babeljs plugin
sample 1: defining an async function
input:
async function divide(a,b)
{
return a/b;
}
output:
function divide(a, b, callback) {
callback(null, a / b);
}
sample 2: invoking async function
input:
async function fn() {
return await divide(8,2) + await divide(10,2);
}
output:
divide(8, 2, function(err$, res$1) {
if (err$) return callback(err$);
divide(10, 2, function(err$, res$2) {
if (err$) return callback(err$);
callback(null, res$1+res$2);
});
});