MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / byteLengthUtf8

Function byteLengthUtf8

source code/utils/bash/bashParser.ts:635–647  ·  view source on GitHub ↗
(s: string)

Source from the content-addressed store, hash-verified

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

Callers 1

parseSourceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected