Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Avoid use of Number.isFinite() #711

Merged
merged 2 commits into from
Mar 8, 2018
Merged

Fix: Avoid use of Number.isFinite() #711

merged 2 commits into from
Mar 8, 2018

Conversation

jeremypress
Copy link
Contributor

@jeremypress jeremypress commented Mar 8, 2018

Number.isFinite() is not supported in IE, and all it does is check that the input is a number and call the global isFinite, which is supported everywhere.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isFinite

@boxcla
Copy link

boxcla commented Mar 8, 2018

Verified that @jeremypress has signed the CLA. Thanks for the pull request!

Copy link
Contributor

@DanDeMicco DanDeMicco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 seems like isFinite isn't really needed here though

@@ -540,7 +540,8 @@ class MediaBaseViewer extends BaseViewer {
* @return {boolean} - true if time is valid
*/
isValidTime(time) {
return typeof time === 'number' && Number.isFinite(time) && time >= 0 && time <= this.mediaEl.duration;
// eslint-disable-next-line
return typeof time === 'number' && isFinite(time) && time >= 0 && time <= this.mediaEl.duration;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove isFinite, since we are doing bounds check

@jeremypress jeremypress merged commit 0f31aee into box:master Mar 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants