MCPcopy Index your code
hub / github.com/microsoft/typescript-go / DecodeJSStringRune

Function DecodeJSStringRune

internal/stringutil/util.go:343–351  ·  view source on GitHub ↗
(s string)

Source from the content-addressed store, hash-verified

341}
342
343func DecodeJSStringRune(s string) (rune, int) {
344 if len(s) >= 3 &&
345 s[0] == surrogateUTF8Lead &&
346 s[1] >= surrogateUTF8Byte1Min && s[1] <= surrogateUTF8Byte1Max &&
347 s[2] >= utf8ContMarker && s[2] <= utf8ContMax {
348 return surrogateUTF8LeadBits | rune(s[1]&utf8ContMask)<<6 | rune(s[2]&utf8ContMask), 3
349 }
350 return utf8.DecodeRuneInString(s)
351}
352
353// CombineSurrogatePairs canonicalizes a JS-string value produced by
354// concatenation, merging any adjacent high+low surrogate sentinel pair (as

Callers 15

skipWhitespaceFunction · 0.92
scanNonWhitespaceFunction · 0.92
skipSingleLineWhitespaceFunction · 0.92
escapeStringWorkerFunction · 0.92
applyStringMappingFunction · 0.92
ComputePositionMapFunction · 0.92
scanClassRangesMethod · 0.92

Calls 1

lenFunction · 0.85

Tested by

no test coverage detected