0.0.4 • Published 1 year ago

node-data-runner v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Node Data Runner

Calls a function for each value in an array and waits for a timeout between each call.

Usage

Useful for rate limiting api calls.

const {run} = require('node-data-runner')

function increment(x) {
    return x + 1
}

// runs increment function on 1,2,3 array every 200ms
run([1, 2, 3], increment, 200).then(console.log)

// expects [2,3,4]

function flip (x,y) {
    return [y,x]
}

// can also pass multiple arguments to the function with an array
run([[1,2]], flip, 200).then(console.log)

//expects [[2,1]]
0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago