Merge pull request #19880 from Snuffleupagus/numberToString-assert-number

Assert that `numberToString` is called with a number (issue 19877)
This commit is contained in:
Jonas Jenwald 2025-04-29 20:35:32 +02:00 committed by GitHub
commit 0922aa9e9d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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();
}