json-formula
json-formula copied to clipboard
String to number conversion corner cases
When implementing the spec, I assumed, that for a string to coerce to a number it should, basically, contain a number literal per json-formula rules. But it looks like in the implementation the JavaScript rules are used, which makes an expression like this work:
0 + "0x10" + "0o10" + "0b10" + "010" -> 36
Also there is this expression, which returns an invalid JSON value:
0 + "Infinity" -> Infinity
I stumbled upon this with "_localDate", but there it was just the leading zero.
It seems like something, that would be better to describe more thoroughly in the spec, as this could cause differences in implementations. Especially with leading zeros, which could be treated as octal markers.