Skip to content

Commit

Permalink
Ensure that when we check typeof x == 'number' we also check
Browse files Browse the repository at this point in the history
  • Loading branch information
etimberg committed Oct 1, 2018
1 parent 9293c30 commit 1e69c98
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/core/core.element.js
Expand Up @@ -42,7 +42,7 @@ function interpolate(start, view, model, ease) {
continue;
}
}
} else if (type === 'number' && isFinite(origin) && isFinite(target)) {
} else if ((type === 'number' || target instanceof Number) && isFinite(origin) && isFinite(target)) {
view[key] = origin + (target - origin) * ease;
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/core.scale.js
Expand Up @@ -519,7 +519,7 @@ module.exports = Element.extend({
return NaN;
}
// isNaN(object) returns true, so make sure NaN is checking for a number; Discard Infinite values
if (typeof rawValue === 'number' && !isFinite(rawValue)) {
if ((typeof rawValue === 'number' || rawValue instanceof Number) && !isFinite(rawValue)) {
return NaN;
}
// If it is in fact an object, dive in one more level
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/plugin.filler.js
Expand Up @@ -128,7 +128,7 @@ function computeBoundary(source) {
return target;
}

if (typeof target === 'number' && isFinite(target)) {
if ((typeof target === 'number' || target instanceof Number) && isFinite(target)) {
horizontal = scale.isHorizontal();
return {
x: horizontal ? target : null,
Expand Down

0 comments on commit 1e69c98

Please sign in to comment.