breeze

Functional async flow control library

Breeze

Functional async flow control library.

Node.js / Browserify

var breeze = require('breeze')
  • breeze() - Initialize breeze flow system
  • .when(arg, next) - When arg is truthy, add next to the stack
  • .maybe(arg, next) - When arg is truthy, add next to the stack, sugar for breeze.when
  • .some(arg, next) - When arg is truthy and no other some or none has ran, add to the stack
  • .none(next) - Whenever no some have ran, add callback to the stack
  • .then(next) - Add callback to stack
  • .catch(next) - Any error caught will terminate stack and be sent here
  • .reset() - Reset current system
breeze()
  .maybe(1 === 1, function (done) {
    console.log(1)
    done(null, 'hey,', 'you can pass values!')
  })
  .some(1 === 0, function (donemsg) {
    console.log(2, msg)
    done()
  })
  .none(function (donepart1part2) {
    console.log(2, ',since no some happened,', part1, part2)
    done()
  })
  .then(function (done) {
    console.log(3)
    done('It finally happened.')
  })
  .catch(function (err) {
    console.error('An error occurred!', err)
  })

Licensed under The MIT License.