We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 43a11c5 commit 0ef6f19Copy full SHA for 0ef6f19
1 file changed
src/lang.ts
@@ -236,7 +236,7 @@ export const sumBy = <T>(
236
fn: (x: T) => number,
237
): number => {
238
let s = 0;
239
- for (const item of items) {
+ for (const item of items ?? []) {
240
s += fn(item);
241
}
242
return s;
@@ -247,7 +247,7 @@ export const countBy = <T>(
247
fn: (x: T) => boolean,
248
249
250
251
if (fn(item)) {
252
s++;
253
0 commit comments