2.0.0 • Published 10 years ago

function-flow v2.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
10 years ago

function-flow

Enables asynchronous sequence/parallel execution flow.

API

Function.async(...operations)
Function.asyncMap(array, [functor], callback)

Basic Usage

    // sequence
    Function.async(

        (next) => {
            
            next(null, 1)
        },

        (num, next) => {
        
            setTimeout(()=>{next(null, num+1)}, 100);
            
        },
        (num, next) => {
        
            setTimeout(()=>{next(null, num+1)}, 100);
        },
        (err, result) => {
        
            result.should.be.equal(3)
        }
    );

    Function.asyncMap(
        [1,2,3]
        ,
        (item, next) => {

            setTimeout(()=>{next(null, item+1)}, 100);
        }
        ,
        (err, results) => {

            results[2].should.be.equal(4);
        }
    );

See also Tests for more samples.

Repo

https://github.com/alitskevich/function-async

Legal

The MIT License (MIT)

Copyright (c) 2015 Alex Litskevich

2.0.0

10 years ago

1.1.0

10 years ago

1.0.6

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago