MCPcopy Index your code
hub / github.com/glideapps/quicktype / commitInterval

Function commitInterval

src/Strings.ts:334–350  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

332 }
333
334 function commitInterval(): void {
335 if (intervalStart === undefined) {
336 return panic("Tried to commit interval without starting one");
337 }
338 assert(i > intervalStart, "Interval must be non-empty");
339 // FIXME: This is a hack to avoid splitting up surrogates. We shouldn't
340 // look at surrogates individually in the first place. When we
341 // encounter a high surrogate we have to combine it with the low
342 // surrogate and then do the logic on the code point. Right now we're
343 // only operating on UTF16 char codes, which is wrong.
344 if (!atEnd() && isLowSurrogate(currentCodePoint())) {
345 i += 1;
346 }
347 const allUpper = lastLowerCaseIndex === undefined || lastLowerCaseIndex < intervalStart;
348 intervals.push([intervalStart, i, allUpper]);
349 intervalStart = undefined;
350 }
351
352 function intervalLength(): number {
353 if (intervalStart === undefined) {

Callers 1

splitIntoWordsFunction · 0.85

Calls 5

panicFunction · 0.90
assertFunction · 0.90
atEndFunction · 0.85
isLowSurrogateFunction · 0.85
currentCodePointFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…