Skip to content
Permalink
Browse files

Change isNumber implementation

Fixes a minor bug in an extreme edge case.
  • Loading branch information...
trevnorris committed Aug 29, 2019
1 parent 13ee101 commit a55cee090c6b73ae08d8a530746c4f153efa75e8
Showing with 15 additions and 3 deletions.
  1. +7 −1 dist/jstat.js
  2. +1 −1 dist/jstat.min.js
  3. +7 −1 src/core.js
@@ -34,7 +34,13 @@ function isFunction(arg) {


function isNumber(arg) {
return typeof arg === 'number' && arg === arg;
if (typeof num === 'number') {
return num - num === 0;
}
if (typeof num === 'string' && num.trim() !== '') {
return Number.isFinite ? Number.isFinite(+num) : isFinite(+num);
}
return false;
}


Large diffs are not rendered by default.

@@ -25,7 +25,13 @@ function isFunction(arg) {


function isNumber(arg) {
return typeof arg === 'number' && arg === arg;
if (typeof num === 'number') {
return num - num === 0;
}
if (typeof num === 'string' && num.trim() !== '') {
return Number.isFinite ? Number.isFinite(+num) : isFinite(+num);
}
return false;
}


0 comments on commit a55cee0

Please sign in to comment.
You can’t perform that action at this time.