willconant / flow-js

Javascript Library for Multi-step Asynchronous Logic
MIT License
302 stars 15 forks source link

anyError helper method #7

Closed printercu closed 11 years ago

printercu commented 11 years ago

I wrote helper method to use with MULTI(). It just returns first error, null if there is no any. Usage example:

flow.exec(function() {
  smth(MULTI());
  smth2(MULTI());
}, function(results) {
  var err;
  err = flow.anyError(results);
  if (err) {
    return this(err);
  }
  // ....
});