fchierad / PRD

Repository to store ECMAScript code used in workflows created with the product NetIQ Identity Manager.
MIT License
2 stars 2 forks source link

PRD.util.JSONobj.get returns NaN #12

Closed bshefflette closed 6 years ago

bshefflette commented 6 years ago

Not sure if this is intended behavior, wanted to bring to your attention so it can be changed or documented.

PRD.util.JSONobj.get( {"aaa":1,"ggg":null}, 'ggg', 'number') returns NaN

fchierad commented 6 years ago

hmmmm root cause of that behavior is that the module is using parseInt() to coerce the string instead of Number. I had not realized there were differences in how they handle null, Number( null ) is +0 and parseInt( null ) is NaN.

fchierad commented 6 years ago

After reading more about both on the spec decided to perform the coercion with Number() instead of parseInt() . Only 2 functions are using parseInt() at the moment. change checked into v1.0.4wip.