shortcake
Version:
Asynchronous invoke and other goodies for cake.
25 lines (18 loc) • 565 B
text/coffeescript
import parallel from './parallel'
import serial from './serial'
import {isArray, isFunction} from '../utils'
wrap = (fn) ->
(tasks, opts, cb) ->
tasks = [tasks] unless isArray tasks
if isFunction opts
[] = [opts, {}]
opts ?= {}
fn tasks, opts, cb
wrapper = wrap serial
wrapper.serial = wrapper
wrapper.parallel = wrap parallel
export default wrapper