function-batch
Creates a batched function that will batch up all calls to it, and then after a threshold call the original function with all the args combined.
How to Install
npm install function-batch
Usage
; const returnArr = arr;const returnArrBatched = ; const value = Promiseall ; ; ; ;;
Currently function-batch
only supports batching up arrays.
Support for different kinds of args will be added if requested!
Api
function: functionBatch(func, wait, options): Promise<*>
param | type | required |
---|---|---|
func | Function | yes |
wait | number | yes |
options | Options | no |
object: Options
param | type | required |
---|---|---|
leading | boolean | no |
trailing | boolean | no |
maxWait | number | no |