MCPcopy Index your code
hub / github.com/codeaashu/claude-code / byteLengthUtf8

Function byteLengthUtf8

src/utils/bash/bashParser.ts:633–645  ·  view source on GitHub ↗
(s: string)

Source from the content-addressed store, hash-verified

631}
632
633function byteLengthUtf8(s: string): number {
634 let b = 0
635 for (let i = 0; i < s.length; i++) {
636 const c = s.charCodeAt(i)
637 if (c < 0x80) b++
638 else if (c < 0x800) b += 2
639 else if (c >= 0xd800 && c <= 0xdbff) {
640 b += 4
641 i++
642 } else b += 3
643 }
644 return b
645}
646
647function checkBudget(P: ParseState): void {
648 P.nodeCount++

Callers 1

parseSourceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected