You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I parsed the above xml file using the parseNumbers of lib/processors.js which gives the following output:
{ num: { a: -273.17001342773, b: 3, c: 10864548, d: -0.637 } }
The property 'b' shows a value 3 instead of 3.4028234663853E+038.
If I replace lib/processors.js function parseNumbers with the following:
if (!isNaN(value)) {
if (value % 1 === 0 && parseInt(value) == value) {
value = parseInt(value, 10);
} else {
value = parseFloat(value);
}
}
return value;
Now I get the right value for 'b',
{ num:
{ a: -273.17001342773,
b: 3.4028234663853e+38,
c: 10864548,
d: -0.637 } }
The text was updated successfully, but these errors were encountered:
What we really need is a way to provide custom parsers for integer / float numbers, this way one could determine the best way to handle large numbers, like using big.js or similar library. The default parsers would ofc ourse be the current ones.
<num> <a>-273.17001342773</a> <b>3.4028234663853E+038</b> <c>10864548</c> <d>-0.637</d> </num>
I parsed the above xml file using the parseNumbers of lib/processors.js which gives the following output:
{ num: { a: -273.17001342773, b: 3, c: 10864548, d: -0.637 } }
The property 'b' shows a value 3 instead of 3.4028234663853E+038.
If I replace lib/processors.js function parseNumbers with the following:
Now I get the right value for 'b',
{ num:
{ a: -273.17001342773,
b: 3.4028234663853e+38,
c: 10864548,
d: -0.637 } }
The text was updated successfully, but these errors were encountered: