sequential-function-caller
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

repeatCalls Function

The repeatCalls function is designed for calling a function multiple times, dividing the calls into chunks and executing them sequentially.

Import

You can import the repeatCalls function in two ways, depending on your preference:

CommonJS (Node.js)

const { repeatCalls } = require('sequential-function-caller');

ES6 Modules (Browsers, Node.js with ESM)

import { repeatCalls } from 'sequential-function-caller';

Usage

import { repeatCalls } from 'sequential-function-caller';

const exampleFunction = (a) => { 
    console.log(a); 
    return a; 
};

repeatCalls({
    functionToExecute: exampleFunction,
    totalCalls: 9,
    chunkSize: 3,
    payloadArray: [1,2,3,4,5,6,7,8,9],
    delayMs: 1000
}).then(response => {
    console.log(response);
});

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Package Sidebar

Install

npm i sequential-function-caller

Weekly Downloads

9

Version

1.0.6

License

MIT

Unpacked Size

15.4 kB

Total Files

9

Last publish

Collaborators

  • andrii-nastenko