2.0.0 • Published 8 years ago

function-flow v2.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
8 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

8 years ago

1.1.0

9 years ago

1.0.6

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago