This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function sequentialCallback (...fns) { | |
| return (...args) => { | |
| const done = args.pop() | |
| const next = (error, ...args) => { | |
| if (error) return done(error) | |
| if (fns.length) { | |
| const fn = fns.shift() | |
| return fn(...args, next) | |
| } | |
| return done(null, ...args) |
NewerOlder