function-looper

1.0.2 • Public • Published

This is an early version of this module. It's intended to repeat or execute a function multiple times define by the second argument, you use a third argument as an optional delay between executions. At the end it returns a promise that resolves to an array with the results of each execution. It should work with async functions as well.

const { repeat } = require("function-looper");
 
function whateverFunction(iterator) {
  return "Hello" + iterator;
}
 
repeat(whateverFunction, 6, 50000).then(console.log); //: [ 'Hello1', 'Hello2', 'Hello3', 'Hello4', 'Hello5', 'Hello6' ]

The third param is optional and defaults to 0

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    15
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.2
    15
  • 1.0.1
    2
  • 1.0.0
    2

Package Sidebar

Install

npm i function-looper

Weekly Downloads

12

Version

1.0.2

License

MIT

Unpacked Size

1.87 kB

Total Files

3

Last publish

Collaborators

  • kervin5