Skip to content

Commit

Permalink
Merge pull request #2146 from adroitwhiz/no-ie-hacks
Browse files Browse the repository at this point in the history
Remove Internet Explorer-specific Number.isNaN polyfill
  • Loading branch information
kchadha authored Sep 17, 2019
2 parents 1dc2e3f + 3410f42 commit 30ee33c
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/util/cast.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
const Color = require('../util/color');

/**
* Store and possibly polyfill Number.isNaN. Number.isNaN can save time over
* self.isNaN by not coercing its input. We need to polyfill it to support
* Internet Explorer.
* @const
*/
const _NumberIsNaN = Number.isNaN || isNaN;

/**
* @fileoverview
* Utilities for casting and comparing Scratch data-types.
Expand All @@ -33,13 +25,13 @@ class Cast {
if (typeof value === 'number') {
// Scratch treats NaN as 0, when needed as a number.
// E.g., 0 + NaN -> 0.
if (_NumberIsNaN(value)) {
if (Number.isNaN(value)) {
return 0;
}
return value;
}
const n = Number(value);
if (_NumberIsNaN(n)) {
if (Number.isNaN(n)) {
// Scratch treats NaN as 0, when needed as a number.
// E.g., 0 + NaN -> 0.
return 0;
Expand Down

0 comments on commit 30ee33c

Please sign in to comment.