MCPcopy Index your code
hub / github.com/anomalyco/models.dev / sortModels

Function sortModels

packages/web/src/render.tsx:1560–1574  ·  view source on GitHub ↗
(models: ModelEntry[])

Source from the content-addressed store, hash-verified

1558}
1559
1560function sortModels(models: ModelEntry[]) {
1561 return [...models].sort((a, b) => {
1562 const updated = (b.metadata.last_updated ?? "").localeCompare(
1563 a.metadata.last_updated ?? "",
1564 );
1565 if (updated !== 0) return updated;
1566
1567 const released = (b.metadata.release_date ?? "").localeCompare(
1568 a.metadata.release_date ?? "",
1569 );
1570 if (released !== 0) return released;
1571
1572 return a.metadata.name.localeCompare(b.metadata.name);
1573 });
1574}
1575
1576function displayModelName(entry: ProviderModelEntry) {
1577 return entry.canonical?.metadata.name ?? entry.model.name;

Callers 3

render.tsxFile · 0.85
buildLabEntriesFunction · 0.85
buildPagesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected