Files
buildpath/frontend/eslint-polyfill.mjs
Valentin Haudiquet 0e0a12513e
All checks were successful
pipeline / lint-and-format (push) Successful in 4m40s
pipeline / build-and-push-images (push) Successful in 2m25s
fix: fix lint by using polyfill
2026-04-26 01:19:32 +02:00

14 lines
397 B
JavaScript

// Polyfill for Object.groupBy (requires Node.js 21+, we're on 20)
// This must be imported before any code that uses Object.groupBy
if (typeof Object.groupBy === 'undefined') {
Object.groupBy = (items, keyFn) => {
const result = {}
let index = 0
for (const item of items) {
const key = keyFn(item, index++)
;(result[key] ??= []).push(item)
}
return result
}
}