asynccbn

0.0.3 • Public • Published

asynccbn

Babel Plugin to transpile EcmaScript7 async function transpiled into callbacks.

Build Status Dependencies Coverage Status

NPM

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);
   });
 });  

Package Sidebar

Install

npm i asynccbn

Weekly Downloads

2

Version

0.0.3

License

Apache2

Last publish

Collaborators

  • thr0w