MCPcopy Create free account
hub / github.com/LibPDF-js/core / readNumber

Method readNumber

src/fontbox/cmap/parser.ts:588–609  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

586 }
587
588 private readNumber(): number {
589 let str = "";
590
591 while (this.position < this.data.length) {
592 const ch = this.data[this.position];
593
594 if (!isDigit(ch) && ch !== 0x2e) {
595 // not digit or .
596 break;
597 }
598
599 str += String.fromCharCode(ch);
600
601 this.position++;
602 }
603
604 if (str.includes(".")) {
605 return parseFloat(str);
606 }
607
608 return parseInt(str, 10);
609 }
610
611 private readOperator(): Operator {
612 let op = "";

Callers 1

parseNextTokenMethod · 0.95

Calls 1

isDigitFunction · 0.70

Tested by

no test coverage detected