Open adriankb opened 9 years ago
Using JayData 1.3.4
$data.Decimal converter fails when the string value is a scientific notation number.
i.e. 8.90170295494883e-05
fails the check
if (!/^-?([0-9]+(.[0-9]+)?|Infinity)$/.test(value)) throw 0;
to check for a scientific notation number you can use
/[+-]?(?:0|[1-9]\d)(?:.\d)?(?:[eE][+-]?\d+)?/.test(value)
and then to convert it use
floatVal = Number(value); if (isNaN(floatVal)) { throw 0; }
Thanks, it'll get into the next update - which is in about two weeks
Using JayData 1.3.4
$data.Decimal converter fails when the string value is a scientific notation number.
i.e. 8.90170295494883e-05
fails the check
if (!/^-?([0-9]+(.[0-9]+)?|Infinity)$/.test(value)) throw 0;
to check for a scientific notation number you can use
/[+-]?(?:0|[1-9]\d)(?:.\d)?(?:[eE][+-]?\d+)?/.test(value)
and then to convert it use
floatVal = Number(value); if (isNaN(floatVal)) { throw 0; }