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

Function formatNumber

src/annotations/appearance/highlight.ts:124–132  ·  view source on GitHub ↗

* Format a number for PDF content stream.

(n: number)

Source from the content-addressed store, hash-verified

122 * Format a number for PDF content stream.
123 */
124function formatNumber(n: number): string {
125 const rounded = Math.round(n * 10000) / 10000;
126
127 if (Number.isInteger(rounded)) {
128 return String(rounded);
129 }
130
131 return rounded.toString();
132}

Callers 1

Calls 2

isIntegerMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected