feature: vor und nachteile

This commit is contained in:
Hikyu
2026-05-31 13:54:31 +02:00
parent 552a947a1c
commit e3dad17446
23270 changed files with 3024794 additions and 200 deletions
+13
View File
@@ -0,0 +1,13 @@
//#region src/array/reduceAsync.ts
async function reduceAsync(array, reducer, initialValue) {
let startIndex = 0;
if (initialValue == null) {
initialValue = array[0];
startIndex = 1;
}
let accumulator = initialValue;
for (let i = startIndex; i < array.length; i++) accumulator = await reducer(accumulator, array[i], i, array);
return accumulator;
}
//#endregion
export { reduceAsync };