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

Function wordStart

ark/docs/components/shell/SearchPanel.tsx:491–495  ·  view source on GitHub ↗
(text: string, start: number, limit: number)

Source from the content-addressed store, hash-verified

489
490/** moves `start` forward to the beginning of a word, but never past `limit` */
491const wordStart = (text: string, start: number, limit: number) => {
492 if (start === 0) return 0
493 const space = text.slice(start - 1, limit).search(/\s/)
494 return space === -1 ? limit : start + space
495}
496
497/** moves `end` back to the end of a word, but never before `floor` */
498const wordEnd = (text: string, end: number, floor: number) => {

Callers 1

excerptFunction · 0.85

Calls 1

searchMethod · 0.45

Tested by

no test coverage detected