From dbbb763eaf8631095cff308275e2fd9275d00b14 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sat, 21 Oct 2017 12:58:53 +0200 Subject: [PATCH] Replace `Number` polyfills with the ones from core-js Since we're already using core-js elsewhere in `compatibility.js`, we can reduce the amount of code we need to maintain ourselves. https://github.com/zloirock/core-js#ecmascript-6-number --- src/shared/compatibility.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/shared/compatibility.js b/src/shared/compatibility.js index 9d2f45125..27a42e003 100644 --- a/src/shared/compatibility.js +++ b/src/shared/compatibility.js @@ -845,9 +845,7 @@ PDFJS.compatibilityChecked = true; if (Number.isNaN) { return; } - Number.isNaN = function(value) { - return typeof value === 'number' && isNaN(value); - }; + Number.isNaN = require('core-js/fn/number/is-nan'); })(); // Provides support for Number.isInteger in legacy browsers. @@ -856,10 +854,7 @@ PDFJS.compatibilityChecked = true; if (Number.isInteger) { return; } - Number.isInteger = function(value) { - return typeof value === 'number' && isFinite(value) && - Math.floor(value) === value; - }; + Number.isInteger = require('core-js/fn/number/is-integer'); })(); /**