Commit 393ff72
util: fix numericSeparator with negative fractional numbers
Fix util.inspect() formatting bug where negative fractional numbers
between -1 and 0 lost their minus sign when numericSeparator was true.
Fixed formatNumber function to preserve sign by using original string
representation. Also corrected test expectations for scientific notation
to not apply numeric separators.
Fixes: #59376
PR-URL: #59379
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>1 parent 76001f9 commit 393ff72Copy full SHA for 393ff72
File tree
Expand file treeCollapse file tree
2 files changed
+35
-9
lines changedOpen diff view settings
Filter options
- lib/internal/util
- test/parallel
Expand file treeCollapse file tree
2 files changed
+35
-9
lines changedOpen diff view settings
Collapse file
lib/internal/util/inspect.js
Copy file name to clipboardExpand all lines: lib/internal/util/inspect.js+14-9Lines changed: 14 additions & 9 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1639 | 1639 | |
1640 | 1640 | |
1641 | 1641 | |
| 1642 | + |
| 1643 | + |
1642 | 1644 | |
1643 | | - |
| 1645 | + |
1644 | 1646 | |
1645 | | - |
1646 | | - |
| 1647 | + |
| 1648 | + |
1647 | 1649 | |
1648 | | - |
| 1650 | + |
1649 | 1651 | |
1650 | 1652 | |
1651 | | - |
| 1653 | + |
1652 | 1654 | |
| 1655 | + |
| 1656 | + |
| 1657 | + |
| 1658 | + |
| 1659 | + |
1653 | 1660 | |
1654 | | - |
| 1661 | + |
1655 | 1662 | |
1656 | | - |
1657 | | - |
1658 | | - |
| 1663 | + |
1659 | 1664 | |
1660 | 1665 | |
1661 | 1666 | |
|
Collapse file
test/parallel/test-util-inspect.js
Copy file name to clipboardExpand all lines: test/parallel/test-util-inspect.js+21Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
3313 | 3313 | |
3314 | 3314 | |
3315 | 3315 | |
| 3316 | + |
| 3317 | + |
| 3318 | + |
| 3319 | + |
| 3320 | + |
| 3321 | + |
| 3322 | + |
| 3323 | + |
| 3324 | + |
| 3325 | + |
| 3326 | + |
| 3327 | + |
| 3328 | + |
| 3329 | + |
| 3330 | + |
| 3331 | + |
| 3332 | + |
| 3333 | + |
| 3334 | + |
| 3335 | + |
| 3336 | + |
3316 | 3337 | |
3317 | 3338 | |
3318 | 3339 | |
|
0 commit comments