Describe the bug
I have array cells in my document that can contain a mix of values like 6 or "6-7". I want the numbers to be treated as numbers and the others to be treated as strings. But values like "6-7" are coerced to 6 in the output. This is true even in arrays that are all string values like "6-7"/"6-7"/"6-7" (/ is my seperator here).
My guess would be it has something to do with use of parseFloat in getCellContentArray (because parseFloat('6-7') === 6).
I could try to do a PR at some point but what I've done to deal with similar situations in the past is check the length of parseFloat(val) against the length of val and if they are different treat val as a string -- not sure that is totally robust though.
Describe the bug I have array cells in my document that can contain a mix of values like
6
or"6-7"
. I want the numbers to be treated as numbers and the others to be treated as strings. But values like"6-7"
are coerced to6
in the output. This is true even in arrays that are all string values like"6-7"/"6-7"/"6-7"
(/
is my seperator here).To Reproduce Steps to reproduce the behavior:
"6-7"/"6-7"/"6-7"
JA_foo
[ { "foo": [ 6, 6, 6 ] } ]
Expected behavior JSON output sould be
[ { "foo": [ "6-7", "6-7", "6-7" ] } ]
Screenshots
Here's some test cases against the actual output:
Info (please complete the following information):
Possible solution
My guess would be it has something to do with use of
parseFloat
ingetCellContentArray
(becauseparseFloat('6-7') === 6
).I could try to do a PR at some point but what I've done to deal with similar situations in the past is check the length of
parseFloat(val)
against the length ofval
and if they are different treatval
as a string -- not sure that is totally robust though.