MCPcopy Create free account
hub / github.com/anomalyco/models.dev / parseSearchIndex

Function parseSearchIndex

packages/web/src/index.ts:96–106  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

94// Search
95////////////////////
96function parseSearchIndex() {
97 const index = document.getElementById("search-index")?.textContent;
98 if (!index) return [];
99
100 try {
101 const parsed = JSON.parse(index);
102 return Array.isArray(parsed) ? (parsed as SearchIndexItem[]) : [];
103 } catch {
104 return [];
105 }
106}
107
108function normalizeSearchText(value: string) {
109 return value.toLowerCase().replace(/[^a-z0-9]+/g, " ").trim();

Callers 1

index.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected