single-batch
Low level utility to handle single or batch methods.
Install
$ npm install single-batch
Usage
const obj = Promise const wrapped = wrapped // 3wrapped // [3, 4]
wrap(single, batch, context, singleArg)
- single
function()
- batch
function()
- context
Object=
- singleArg
Boolean=false
Returns
null
if single and batch methods are both unavailable{single: function, batch: function}
singleArg
If true, then wrapped.single
only accept one argument, and each argument of wrapped.batch
corresponds to the argument of wrapped.single
// singleArg: truewrappedwrapped wrappedwrapped
If false, wrapped.single
accept multiple arguments, and each argument of wrapped.batch
must be an array which represents the arguments of wrapped.single
wrappedwrapped wrappedwrapped
License
MIT