all files / util/ async.js

87.5% Statements 7/8
83.33% Branches 5/6
100% Functions 2/2
100% Lines 7/7
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17          12× 12×   12× 12×        
/*
  Run the functions in the tasks collection in series.
 
  NOTE: You can not access results of the executed functions
*/
export function series(tasks, cb, i) {
  i = i || 0
  tasks[i](function(err) {
    // Always stop execution on error
    Iif (err) return cb(err)
    if (i === tasks.length-1) {
      cb(...arguments) // we are done
    } else {
      series(tasks, cb, i + 1)
    }
  })
}