MCPcopy Create free account
hub / github.com/Oslonline/dithering-studio / getOrderedAlgorithmDetails

Function getOrderedAlgorithmDetails

src/utils/algorithmInfo.ts:70–97  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

68 * This keeps the Education/Explorer UI aligned with the actual implementation.
69 */
70export function getOrderedAlgorithmDetails(): AlgorithmDetail[] {
71 const byId = new Map<number, AlgorithmDetail>(algorithmDetails.map((d) => [d.id, d]));
72
73 return algorithms.map((meta) => {
74 const existing = byId.get(meta.id);
75 if (existing) {
76 const technicalSummary = getAlgorithmTechnicalSummary(meta.id);
77 const merged = technicalSummary ? { ...existing, technicalSummary } : existing;
78 // Ensure name/category stay consistent with the registry.
79 if (merged.name !== meta.name || merged.category !== meta.category) {
80 return { ...merged, name: meta.name, category: meta.category };
81 }
82 return merged;
83 }
84
85 // Fallback: registry algorithm exists but has no long-form info entry yet.
86 return {
87 id: meta.id,
88 name: meta.name,
89 category: meta.category,
90 overview: "",
91 characteristics: [],
92 artifacts: [],
93 bestFor: [],
94 complexity: "O(N)",
95 };
96 });
97}
98
99export const getAlgorithmDetail = (id: number) => getOrderedAlgorithmDetails().find((a) => a.id === id);

Callers 4

AlgorithmDetailPageFunction · 0.90
AlgorithmExplorerFunction · 0.90
getAlgorithmDetailFunction · 0.85

Calls 1

Tested by

no test coverage detected