MCPcopy Create free account
hub / github.com/nodejs/nodejs.org / groupReleasesByStatus

Function groupReleasesByStatus

apps/site/components/withReleaseSelect.tsx:17–37  ·  view source on GitHub ↗
(releases: Array<NodeRelease>)

Source from the content-addressed store, hash-verified

15 * formatted with the major version and codename if available.
16 */
17const groupReleasesByStatus = (releases: Array<NodeRelease>) => {
18 const groupedByStatus = releases.reduce((acc, release) => {
19 const { status, major, codename, versionWithPrefix } = release;
20
21 if (!acc[status]) {
22 acc[status] = [];
23 }
24
25 acc[status].push({
26 label: `Node.js v${major}.x ${codename ? `(${codename})` : ''}`,
27 value: `/download/archive/${versionWithPrefix}`,
28 });
29
30 return acc;
31 }, {} as Navigations);
32
33 return STATUS_ORDER.filter(status => groupedByStatus[status]).map(status => ({
34 label: status,
35 items: groupedByStatus[status],
36 }));
37};
38
39type WithReleaseSelectProps = Omit<
40 ComponentProps<typeof StatelessSelect>,

Callers 1

WithReleaseSelectFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected