Assert that numberToString is called with a number (issue 19877)

*NOTE:* Given that this is an *internal* function, used only in the worker-thread, it's not clear to me that this is an entirely "necessary" change.
This commit is contained in:
Jonas Jenwald 2025-04-29 11:17:38 +02:00
parent c1a398d932
commit f5faf86180

View File

@ -632,6 +632,13 @@ function recoverJsURL(str) {
}
function numberToString(value) {
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("TESTING")) {
assert(
typeof value === "number",
`numberToString - the value (${value}) should be a number.`
);
}
if (Number.isInteger(value)) {
return value.toString();
}