e
Eek
🤣 2
c
Gotta love javascript!
Would be interesting to see what isNumber() looks like in util
b
Copy code
/**
 * Determines if a variable refers to a number
 *
 * @memberof util
 * @name util.isNumber
 *
 * @param obj
 * @returns {boolean}
 */
function isNumber(obj) {
  return Object.prototype.toString.call(obj) === "[object Number]";
}
missing code to handle NaN
c
@battk how did you find the impl?
b
clientside debugger
c
Copy code
/**
 * Determines if a variable refers to a number
 *
 * @memberof util
 * @name util.isNumber
 *
 * @param obj
 * @returns {boolean}
 */
isNumber: function (obj) {},
This is all I can see in SuiteScript_2_0
Ahh right
s
I don't use that
util
module
s
I mean that is expected, the
typeof
NaN
in javascript is
number
😂 1
r
Ontologically curious, but makes sense. NaN is the result of numerical operations, so having it be a number seems like a reasonable design choice.
s
nevertheless,
NaN
is not a number in JS so that utility function is misleading.
r
Well NaN itself is a number, that's what Sandii is saying. It indicates that your value is not a number, but NaN itself is. I get what you mean tho. isNumber() is hardly a good indicator of numericity in the mathematical sense. In the categorical/typing sense tho, isNumber(NaN) === true makes perfect sense.
Sorry, I have a degree in philosophy. lol
e
I probably should have read the docs closer; the example includes
util.isNumber(Nan) //returns true
.
I didn't realise
NaN
is a Number