1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 22:58:07 +02:00

Merge pull request #8643 from Snuffleupagus/polyfill-Number-isNaN

Add `Number.isNaN` and `Number.isInteger` polyfills in compatibility.js, since the Streams polyfill relies on them
This commit is contained in:
Jonas Jenwald 2017-07-13 18:25:46 +02:00 committed by GitHub
commit a63015a9a2

View file

@ -836,6 +836,29 @@ PDFJS.compatibilityChecked = true;
};
})();
// Provides support for Number.isNaN in legacy browsers.
// Support: IE.
(function checkNumberIsNaN() {
if (Number.isNaN) {
return;
}
Number.isNaN = function(value) {
return typeof value === 'number' && isNaN(value);
};
})();
// Provides support for Number.isInteger in legacy browsers.
// Support: IE.
(function checkNumberIsInteger() {
if (Number.isInteger) {
return;
}
Number.isInteger = function(value) {
return typeof value === 'number' && isFinite(value) &&
Math.floor(value) === value;
};
})();
/**
* Polyfill for Promises:
* The following promise implementation tries to generally implement the