diff --git a/src/array/groupBy.ts b/src/array/groupBy.ts index 2791159..0ab40d3 100644 --- a/src/array/groupBy.ts +++ b/src/array/groupBy.ts @@ -4,8 +4,7 @@ export function groupBy(arr: T[], fn: Fn): Recor return arr.reduce( (result, item) => { const key = fn(item) - result[key] = result[key] ?? [] - result[key].push(item) + ;(result[key] ??= []).push(item) return result }, {} as Record,