File tree Expand file tree Collapse file tree 3 files changed +12
-4
lines changed Expand file tree Collapse file tree 3 files changed +12
-4
lines changed Original file line number Diff line number Diff line change 7171 message : " Use `const { WeakMap } = primordials;` instead of the global."
7272 - name : WeakSet
7373 message : " Use `const { WeakSet } = primordials;` instead of the global."
74+ - name : parseFloat
75+ message : " Use `const { NumberParseFloat } = primordials;` instead of the global."
7476 - name : parseInt
7577 message : " Use `const { NumberParseInt } = primordials;` instead of the global."
7678 no-restricted-syntax :
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ const {
2929 MathSqrt,
3030 Number,
3131 NumberIsNaN,
32+ NumberParseFloat,
3233 NumberParseInt,
3334 NumberPrototypeValueOf,
3435 Object,
@@ -1960,7 +1961,8 @@ function formatWithOptionsInternal(inspectOptions, ...args) {
19601961 if ( typeof tempFloat === 'symbol' ) {
19611962 tempStr = 'NaN' ;
19621963 } else {
1963- tempStr = formatNumber ( stylizeNoColor , parseFloat ( tempFloat ) ) ;
1964+ tempStr = formatNumber ( stylizeNoColor ,
1965+ NumberParseFloat ( tempFloat ) ) ;
19641966 }
19651967 break ;
19661968 case 99 : // 'c'
Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ const {
4646 Error,
4747 MathMax,
4848 NumberIsNaN,
49+ NumberParseFloat,
4950 ObjectAssign,
5051 ObjectCreate,
5152 ObjectDefineProperty,
@@ -58,7 +59,9 @@ const {
5859 PromiseRace,
5960 RegExp,
6061 Set,
62+ StringPrototypeCharAt,
6163 StringPrototypeIncludes,
64+ StringPrototypeMatch,
6265 Symbol,
6366 SyntaxError,
6467 SyntaxErrorPrototype,
@@ -791,9 +794,10 @@ function REPLServer(prompt,
791794 // Check to see if a REPL keyword was used. If it returns true,
792795 // display next prompt and return.
793796 if ( trimmedCmd ) {
794- if ( trimmedCmd . charAt ( 0 ) === '.' && trimmedCmd . charAt ( 1 ) !== '.' &&
795- NumberIsNaN ( parseFloat ( trimmedCmd ) ) ) {
796- const matches = trimmedCmd . match ( / ^ \. ( [ ^ \s ] + ) \s * ( .* ) $ / ) ;
797+ if ( StringPrototypeCharAt ( trimmedCmd , 0 ) === '.' &&
798+ StringPrototypeCharAt ( trimmedCmd , 1 ) !== '.' &&
799+ NumberIsNaN ( NumberParseFloat ( trimmedCmd ) ) ) {
800+ const matches = StringPrototypeMatch ( trimmedCmd , / ^ \. ( [ ^ \s ] + ) \s * ( .* ) $ / ) ;
797801 const keyword = matches && matches [ 1 ] ;
798802 const rest = matches && matches [ 2 ] ;
799803 if ( _parseREPLKeyword . call ( self , keyword , rest ) === true ) {
You can’t perform that action at this time.
0 commit comments