Skip to content
This repository was archived by the owner on Apr 6, 2022. It is now read-only.

Commit 3895b54

Browse files
committed
fix(republik-crowdfundings): Set initial value on Array.reduce to 0
Array insertPromises might be an empty array. Setting initial value prevents error "Reduce of empty array with no initial value".
1 parent cd6015d commit 3895b54

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/republik-crowdfundings/lib/scheduler/importPayments.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ const insertPayments = async ({
257257
return await postfinancePaymentsTable.insert(record)
258258
})
259259

260-
return (await Promise.all(insertPromises)).reduce((a, b) => a + b)
260+
return (await Promise.all(insertPromises)).reduce((a, b) => a + b, 0)
261261
}
262262

263263
interface PostfinancePaymentRecord {

0 commit comments

Comments
 (0)