MCPcopy Index your code
hub / github.com/simstudioai/sim / nextIndex

Function nextIndex

apps/sim/hooks/use-smooth-text.ts:32–39  ·  view source on GitHub ↗

* Advance from `start` by `step(...)`, then extend up to 8 more characters to * land just past the next word/punctuation boundary so the reveal lands on a * whole word rather than mid-token.

(text: string, start: number)

Source from the content-addressed store, hash-verified

30 * whole word rather than mid-token.
31 */
32function nextIndex(text: string, start: number): number {
33 const end = Math.min(text.length, start + step(text.length - start))
34 const max = Math.min(text.length, end + 8)
35 for (let i = end; i < max; i++) {
36 if (SNAP.test(text[i] ?? '')) return i + 1
37 }
38 return end
39}
40
41/**
42 * Content already longer than this when streaming begins is assumed to be

Callers 1

runFunction · 0.85

Calls 2

stepFunction · 0.85
testMethod · 0.80

Tested by

no test coverage detected