Skip to content

Commit

Permalink
Switch to Number(), see: phetsims/perennial#275
Browse files Browse the repository at this point in the history
  • Loading branch information
marlitas committed Jun 25, 2022
1 parent 5e79173 commit 483311c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions js/parser/svgPath.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions js/parser/svgPath.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down

0 comments on commit 483311c

Please sign in to comment.