MCPcopy
hub / github.com/niklasvh/html2canvas / consumeNumericToken

Method consumeNumericToken

src/css/syntax/tokenizer.ts:742–759  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

740 }
741
742 private consumeNumericToken(): NumberValueToken | DimensionToken {
743 const [number, flags] = this.consumeNumber();
744 const c1 = this.peekCodePoint(0);
745 const c2 = this.peekCodePoint(1);
746 const c3 = this.peekCodePoint(2);
747
748 if (isIdentifierStart(c1, c2, c3)) {
749 const unit = this.consumeName();
750 return {type: TokenType.DIMENSION_TOKEN, number, flags, unit};
751 }
752
753 if (c1 === PERCENTAGE_SIGN) {
754 this.consumeCodePoint();
755 return {type: TokenType.PERCENTAGE_TOKEN, number, flags};
756 }
757
758 return {type: TokenType.NUMBER_TOKEN, number, flags};
759 }
760
761 private consumeEscapedCodePoint(): number {
762 const codePoint = this.consumeCodePoint();

Callers 1

consumeTokenMethod · 0.95

Calls 5

consumeNumberMethod · 0.95
peekCodePointMethod · 0.95
consumeNameMethod · 0.95
consumeCodePointMethod · 0.95
isIdentifierStartFunction · 0.85

Tested by

no test coverage detected