MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / isNumber

Function isNumber

src/parseTools.mjs:435–438  ·  view source on GitHub ↗
(x)

Source from the content-addressed store, hash-verified

433}
434
435export function isNumber(x) {
436 // XXX this does not handle 0xabc123 etc. We should likely also do x == parseInt(x) (which handles that), and remove hack |// handle 0x... as well|
437 return x == parseFloat(x) || (typeof x == 'string' && x.match(/^-?\d+$/)) || x == 'NaN';
438}
439
440// ensures that a float type has either 5.5 (clearly a float) or +5 (float due to asm coercion)
441function asmEnsureFloat(value, type) {

Callers 3

asmEnsureFloatFunction · 0.70
asmCoercionFunction · 0.70
getFastValueFunction · 0.70

Calls 1

matchMethod · 0.45

Tested by

no test coverage detected