MCPcopy Create free account
hub / github.com/arktypeio/arktype / wordEnd

Function wordEnd

ark/docs/components/shell/SearchPanel.tsx:498–502  ·  view source on GitHub ↗
(text: string, end: number, floor: number)

Source from the content-addressed store, hash-verified

496
497/** moves `end` back to the end of a word, but never before `floor` */
498const wordEnd = (text: string, end: number, floor: number) => {
499 if (end >= text.length) return text.length
500 const space = text.slice(floor, end + 1).search(/\s\S*$/)
501 return space === -1 ? end : floor + space
502}
503
504/** the words around the first matched term, with matches marked */
505const excerpt = (text: string, result: SearchResult): ReactNode => {

Callers 1

excerptFunction · 0.85

Calls 1

searchMethod · 0.45

Tested by

no test coverage detected