diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 8f381a3e..e1bb6a93 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -17,6 +17,7 @@ "@vitejs/plugin-react": "^4.3.1", "autoprefixer": "^10.4.20", "clsx": "^2.1.1", + "es-toolkit": "^1.17.0", "eslint": "^9.9.1", "eslint-plugin-react-hooks": "^5.1.0-rc.0", "eslint-plugin-react-refresh": "^0.4.11", @@ -2842,6 +2843,16 @@ "url": "https://github.com/fb55/entities?sponsor=1" } }, + "node_modules/es-toolkit": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/es-toolkit/-/es-toolkit-1.17.0.tgz", + "integrity": "sha512-aJvpNxK7d+I+Rt9tmdwzelxTe4EwtxX1Kv0xv6ZTRWJBpMCxe0vxTLLW4STz6pHYjtyTTrEkonNXLaBsYHg2Yw==", + "license": "MIT", + "workspaces": [ + "docs", + "benchmarks" + ] + }, "node_modules/esbuild": { "version": "0.21.5", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz", diff --git a/frontend/package.json b/frontend/package.json index 3a8dd6f0..e233ea57 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -23,6 +23,7 @@ "@vitejs/plugin-react": "^4.3.1", "autoprefixer": "^10.4.20", "clsx": "^2.1.1", + "es-toolkit": "^1.17.0", "eslint": "^9.9.1", "eslint-plugin-react-hooks": "^5.1.0-rc.0", "eslint-plugin-react-refresh": "^0.4.11", diff --git a/frontend/src/components/LicenseSidebarBlock/index.tsx b/frontend/src/components/LicenseSidebarBlock/index.tsx index 97e7f368..95a79f6e 100644 --- a/frontend/src/components/LicenseSidebarBlock/index.tsx +++ b/frontend/src/components/LicenseSidebarBlock/index.tsx @@ -3,6 +3,7 @@ import { Fragment, ReactNode } from "react"; import { definitions } from "@/api"; import { Icon } from "../Icon"; import { info } from "@/icons/info"; +import { groupBy } from "es-toolkit"; interface BlockProps { license?: definitions["LicenseList"]; @@ -33,10 +34,7 @@ export function LicenseSidebarBlock(props: BlockProps) { (a, b) => b.confidence - a.confidence, ); - const groupedLicenses = Object.groupBy( - sortedLicenses, - (license) => license.link, - ); + const groupedLicenses = groupBy(sortedLicenses, (license) => license.link); const licenses = Object.entries(groupedLicenses).map(([link, license]) => (