1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 1× 12× 12× 12× 12× 7× 5× | /* 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) } }) } |