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

Function formatNumber

src/annotations/appearance/strikeout.ts:116–124  ·  view source on GitHub ↗

* Format a number for PDF content stream.

(n: number)

Source from the content-addressed store, hash-verified

114 * Format a number for PDF content stream.
115 */
116function formatNumber(n: number): string {
117 const rounded = Math.round(n * 10000) / 10000;
118
119 if (Number.isInteger(rounded)) {
120 return String(rounded);
121 }
122
123 return rounded.toString();
124}

Callers 1

Calls 2

isIntegerMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected