MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / firstMatchColumn

Function firstMatchColumn

apps/desktop/src/main/vault.ts:1642–1656  ·  view source on GitHub ↗
(query: string, text: string)

Source from the content-addressed store, hash-verified

1640}
1641
1642function firstMatchColumn(query: string, text: string): number {
1643 const q = query.trim().toLowerCase()
1644 const t = text.toLowerCase()
1645 const direct = t.indexOf(q)
1646 if (direct >= 0) return direct
1647
1648 let qi = 0
1649 let start = -1
1650 for (let i = 0; i < t.length && qi < q.length; i++) {
1651 if (t[i] !== q[qi]) continue
1652 if (start === -1) start = i
1653 qi++
1654 }
1655 return start >= 0 ? start : 0
1656}
1657
1658function collapseSearchLine(line: string): string {
1659 return line.replace(/\s+/g, ' ').trim()

Callers 1

hydrateSearchOffsetsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected