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

Method readIntegerFromCurrent

src/parser/xref-parser.ts:570–587  ·  view source on GitHub ↗

* Read an integer from current scanner position.

()

Source from the content-addressed store, hash-verified

568 * Read an integer from current scanner position.
569 */
570 private readIntegerFromCurrent(): number | null {
571 let value = 0;
572 let hasDigits = false;
573
574 while (true) {
575 const byte = this.scanner.peek();
576
577 if (byte >= DIGIT_0 && byte <= DIGIT_9) {
578 value = value * 10 + (byte - DIGIT_0);
579 hasDigits = true;
580 this.scanner.advance();
581 } else {
582 break;
583 }
584 }
585
586 return hasDigits ? value : null;
587 }
588
589 /**
590 * Expect and consume a keyword at current position.

Callers 1

parseSubsectionMethod · 0.95

Calls 2

advanceMethod · 0.80
peekMethod · 0.45

Tested by

no test coverage detected