asyn

0.0.1 • Public • Published

Asyn makes Asynchronous code simple.

  1. No nested callbacks
  2. No new introduced APIs, just a simple wrapper for the APIs you know
  3. Minimial syntax
asyn
  (fs.writeFile)('testing','some content',asyn)// func 0
  (fs.readFile)('server.js',asyn)              // func 1
  .end(function(asyn){
    /*
     * Log the second argument (a buffer) of the 2nd func
     */
    console.log(String(asyn[1][1]));
  })
 

An example calling a functions methods and getting a website.

var array = [0,1,false,true,'','1'];
asyn
  (array,'filter')(Boolean)
  (http.get)({host:'www.google.com',port:80,path:'/'},asyn)
  
  .end(function(asyn){
    console.log(asyn[0]);
    asyn[1][0].on('data',function(chunk){
      console.log('BODY:'+chunk)
    })
  })
 
 

/asyn/

    Package Sidebar

    Install

    npm i asyn

    Weekly Downloads

    175

    Version

    0.0.1

    License

    none

    Last publish

    Collaborators

    • limeblack