-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Description
This is ensureNumber
:
Lines 166 to 171 in 8cccacc
lib.ensureNumber = function ensureNumber(v) { | |
if(!isNumeric(v)) return BADNUM; | |
v = Number(v); | |
if(v < -FP_SAFE || v > FP_SAFE) return BADNUM; | |
return isNumeric(v) ? Number(v) : BADNUM; | |
}; |
Any reason the last line isn't just return v;
? This is a pretty hot function. After already filtering out non-numeric values and converting others to Number
explicitly, why would we have to check isNumeric
again?
Originally posted by @alexcjohnson in #5622 (comment)
Metadata
Metadata
Assignees
Labels
No labels