0.0.3 • Published 9 years ago

asynccbn v0.0.3

Weekly downloads
3
License
Apache2
Repository
github
Last release
9 years ago

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