freeflow
Similar to async.auto, but offers partial calculation and different interface.
Last updated 6 years ago by blmarket .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install freeflow 
SYNC missed versions from official npm registry.

Freeflow

Another control-flow extension for some places where async doesn't covers.

What this library for?

async.auto is great feature which offers simple dependency resolution, but it doesn't have target function so all the functions are to be executed. If you have bunch of functions and needs only some of them are to be executed to get needed value, other functions are executed with no use.

async.auto({
  foo: function(callback) { ... }
  bar: function(callback) { ... }
  baz: [ 'foo', function(callback) { ... } ]
});

Think if we only need the result of baz. then bar don't needed to executed in this context but async doesn't have that feature. that's why I coded this library.

How to use?

var freeflow = require('freeflow');
freeflow({
  funcA: function(callback) { ... },
  funcB: function(callback) { ... },
  funcC: function(funcA, funcB, callback) { ... } // dependencies are auto-inferenced
}, 'funcC', function(err, result) {
  ...
});

If you don't like to use auto-inference feature, you can specify dependencies.

var freeflow = require('freeflow');
freeflow({
  funcA: function(callback) { ... },
  funcB: function(callback) { ... },
  funcC: [ 'funcA', 'funcB', function(AR, BR, callback) { ... } ]
}, 'funcC', function(err, result) {
  ...
});

TODO

  • Alternative way without dependency inference.

Current Tags

  • 0.2.0                                ...           latest (6 years ago)

3 Versions

  • 0.2.0                                ...           6 years ago
  • 0.1.1                                ...           6 years ago
  • 0.1.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (2)
Dev Dependencies (5)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |