Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added last completed index to results object #43

Merged
merged 2 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@ const doReq = async (firstName, lastName) => {
return firstName + ' ' + lastName;
};

const users = [{firstName: 'Irene', lastName: 'Pullman'}, {firstName: 'Sean', lastName: 'Parr'}];
const users = [
{firstName: 'Irene', lastName: 'Pullman'},
{firstName: 'Sean', lastName: 'Parr'},
];

//Queue with functions to be run
const queue = users.map(user => () => doReq(user.firstName, user.lastName));
const queue = users.map((user) => () => doReq(user.firstName, user.lastName));

//Default Throttle runs with 5 promises parallel.
const formattedNames = await Throttle.all(queue);
Expand Down Expand Up @@ -86,6 +89,7 @@ The `progressCallback` and the `Raw` will return a `Result` object with the foll

| Property | Type | Start value | Definition |
| :--------------------- | :------ | :---------- | :------------------------------------------------------------------------------------------- |
| lastCompletedIndex | Integer | -1 | last index of a task that is completed (either fulfilled or rejected) |
| amountDone | Integer | 0 | amount of tasks which are finished |
| amountStarted | Integer | 0 | amount of tasks which started |
| amountResolved | Integer | 0 | amount of tasks which successfully resolved |
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "promise-parallel-throttle",
"version": "3.4.1",
"version": "3.5.0",
"keywords": [
"promise",
"async",
Expand Down
Loading