We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c001421 commit f08a582Copy full SHA for f08a582
src/vm/js/nqp-runtime/coercions.js
@@ -1,10 +1,11 @@
1
exports.strToNum = function(str) {
2
+ /* TODO - validate for correctness */
3
/* TODO - more converts more stuff */
4
if (str === 'NaN') return NaN;
5
if (str === 'Inf') return Infinity;
6
if (str === '-Inf') return -Infinity;
7
if (str === '+Inf') return Infinity;
- const parsed = parseFloat(str);
8
+ const parsed = parseFloat(str.replace(/^\u2212/, '-').replace(/_/g, ''));
9
if (isNaN(parsed)) {
10
return 0;
11
}
0 commit comments