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

feat(async): async callback functions in reduce are now called with an additional index parameter #291

Merged
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
4 changes: 2 additions & 2 deletions cdn/radash.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,8 @@ const reduce = async (array, asyncReducer, initValue) => {
}
const iter = initProvided ? array : array.slice(1);
let value = initProvided ? initValue : array[0];
for (const item of iter) {
value = await asyncReducer(value, item);
for (const [i, item] of iter.entries()) {
value = await asyncReducer(value, item, i);
}
return value;
};
Expand Down
4 changes: 2 additions & 2 deletions cdn/radash.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,8 @@ var radash = (function (exports) {
}
const iter = initProvided ? array : array.slice(1);
let value = initProvided ? initValue : array[0];
for (const item of iter) {
value = await asyncReducer(value, item);
for (const [i, item] of iter.entries()) {
value = await asyncReducer(value, item, i);
}
return value;
};
Expand Down
Loading
Loading