From 483311c0145134d90516bfb6ac86df54a9b71695 Mon Sep 17 00:00:00 2001 From: Marla Schulz Date: Sat, 25 Jun 2022 11:42:34 -0600 Subject: [PATCH] Switch to Number(), see: https://github.com/phetsims/perennial/issues/275 --- js/parser/svgPath.js | 4 ++-- js/parser/svgPath.pegjs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/js/parser/svgPath.js b/js/parser/svgPath.js index f525f24..5b33196 100644 --- a/js/parser/svgPath.js +++ b/js/parser/svgPath.js @@ -2096,7 +2096,7 @@ var result = { pos0 = pos; result0 = parse_digitSequence(); if ( result0 !== null ) { - result0 = ( function( offset, number ) { return parseInt( number, 10 ); } )( pos0, result0 ); + result0 = ( function( offset, number ) { return Number( number ); } )( pos0, result0 ); } if ( result0 === null ) { pos = pos0; @@ -2153,7 +2153,7 @@ var result = { pos = pos1; } if ( result0 !== null ) { - result0 = ( function( offset, sign, number ) { return parseInt( sign + number, 10 ); } )( pos0, result0[ 0 ], result0[ 1 ] ); + result0 = ( function( offset, sign, number ) { return Number( sign + number ); } )( pos0, result0[ 0 ], result0[ 1 ] ); } if ( result0 === null ) { pos = pos0; diff --git a/js/parser/svgPath.pegjs b/js/parser/svgPath.pegjs index 4b42f55..96d00a0 100644 --- a/js/parser/svgPath.pegjs +++ b/js/parser/svgPath.pegjs @@ -151,11 +151,11 @@ coordinate nonnegativeNumber = number:floatingPointConstant { return parseFloat( number ); } - / number:integerConstant { return parseInt( number, 10 ); } + / number:integerConstant { return Number( number ); } number = ( sign:sign? number:floatingPointConstant ) { return parseFloat( sign + number ); } - / ( sign:sign? number:integerConstant ) { return parseInt( sign + number, 10 ); } + / ( sign:sign? number:integerConstant ) { return Number( sign + number ); } flag = '0' { return false; } / '1' { return true; }