Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
lib: use Number.parseFloat from primordials
  • Loading branch information
targos committed Oct 4, 2020
commit fef731ccfe2f5995d229a6b3bce84808a0adc867
2 changes: 2 additions & 0 deletions lib/.eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ rules:
message: "Use `const { WeakMap } = primordials;` instead of the global."
- name: WeakSet
message: "Use `const { WeakSet } = primordials;` instead of the global."
- name: parseFloat
message: "Use `const { NumberParseFloat } = primordials;` instead of the global."
- name: parseInt
message: "Use `const { NumberParseInt } = primordials;` instead of the global."
no-restricted-syntax:
Expand Down
4 changes: 3 additions & 1 deletion lib/internal/util/inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const {
MathSqrt,
Number,
NumberIsNaN,
NumberParseFloat,
NumberParseInt,
NumberPrototypeValueOf,
Object,
Expand Down Expand Up @@ -1960,7 +1961,8 @@ function formatWithOptionsInternal(inspectOptions, ...args) {
if (typeof tempFloat === 'symbol') {
tempStr = 'NaN';
} else {
tempStr = formatNumber(stylizeNoColor, parseFloat(tempFloat));
tempStr = formatNumber(stylizeNoColor,
NumberParseFloat(tempFloat));
}
break;
case 99: // 'c'
Expand Down
3 changes: 2 additions & 1 deletion lib/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const {
Error,
MathMax,
NumberIsNaN,
NumberParseFloat,
ObjectAssign,
ObjectCreate,
ObjectDefineProperty,
Expand Down Expand Up @@ -768,7 +769,7 @@ function REPLServer(prompt,
// display next prompt and return.
if (trimmedCmd) {
if (trimmedCmd.charAt(0) === '.' && trimmedCmd.charAt(1) !== '.' &&
Comment thread
targos marked this conversation as resolved.
Outdated
NumberIsNaN(parseFloat(trimmedCmd))) {
NumberIsNaN(NumberParseFloat(trimmedCmd))) {
const matches = trimmedCmd.match(/^\.([^\s]+)\s*(.*)$/);
Comment thread
targos marked this conversation as resolved.
Outdated
const keyword = matches && matches[1];
const rest = matches && matches[2];
Expand Down