isDouble
just checks for numbers:
|
/** |
|
* Handles +-Infinity, Doubles, NaN, -0 |
|
*/ |
|
function isDouble(arr) { |
|
return arr.every(e => typeof e === "number"); |
|
//return arr.some( |
|
// e => |
|
// Number.isNaN(e) || (Number(e) === e && e % 1 !== 0) || Object.is(e, -0) |
|
// ); |
|
} |
This appears to work fine because of the ordering used here, where isDouble
is only used if it’s not an array of Smis:
|
if (isSMI(inputArray)) { |
|
kind = ELEMENTS_KINDS.HOLEY_SMI_ELEMENTS; |
|
} else if (isDouble(inputArray)) { |
|
kind = ELEMENTS_KINDS.HOLEY_DOUBLE_ELEMENTS; |
|
} else { |
Suggested fix: either rename isDouble
to isNumber
, or actually check for double values :)