Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Async Function Composition.
JavaScript
Branch: master

0.0.4

latest commit 2ffac8de6c
@azer authored
Failed to load latest commit information.
.gitignore first commit
.npmignore
.travis.yml
README.md
index.js
package.json 0.0.4
test.js

README.md

comp

Async function composition. Similar to promises.

$ npm install comp

Need more features? See andthen

Usage

steps = comp(step1, step2, step3)

steps(value1, function(error, value4){

    if(error) throw error

    value4
    // => what step3 returns. see below.

})

function step1(value1, callback){}
function step2(value2, callback){}
function step3(value3, callback){}

You can add functions to the composition later;

steps = comp(step1).then(step2).then(step3)

First step may not get any initial value:

steps = comp(step0, step1, step2, step3)

steps(function(error, value4){

    if(error) throw error

    value4
    // => what step3 returns. see below.

})

function step0(callback){

    callback(null, value1)

}

Something went wrong with that request. Please try again.