MCPcopy Index your code
hub / github.com/nodejs/node / charLengthAt

Function charLengthAt

lib/internal/readline/utils.js:50–57  ·  view source on GitHub ↗
(str, i)

Source from the content-addressed store, hash-verified

48}
49
50function charLengthAt(str, i) {
51 if (str.length <= i) {
52 // Pretend to move to the right. This is necessary to autocomplete while
53 // moving to the right.
54 return 1;
55 }
56 return StringPrototypeCodePointAt(str, i) >= kUTF16SurrogateThreshold ? 2 : 1;
57}
58
59/*
60 Some patterns seen in terminal key escape codes, derived from combos seen

Callers 4

onDataFunction · 0.85
[kDeleteRight]Method · 0.85
[kTtyWrite]Method · 0.85
emitKeysFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…