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

isDouble doesn’t actually check for doubles #3

Open
mathiasbynens opened this issue Mar 22, 2018 · 0 comments
Open

isDouble doesn’t actually check for doubles #3

mathiasbynens opened this issue Mar 22, 2018 · 0 comments

Comments

@mathiasbynens
Copy link

isDouble just checks for numbers:

elements-kinds/index.js

Lines 14 to 23 in 2d96ef5

/**
* 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:

elements-kinds/index.js

Lines 46 to 50 in 2d96ef5

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 :)

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

No branches or pull requests

1 participant