-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
Closed
Labels
consoleIssues and PRs related to the console subsystem.Issues and PRs related to the console subsystem.feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.utilIssues and PRs related to the built-in util module.Issues and PRs related to the built-in util module.
Description
The Chromium console supports format specifiers: https://developers.google.com/web/tools/chrome-devtools/console/console-write#string_substitution_and_formatting
In particular, both %i and %d specify an integral argument. Node.js does not perform the conversion for %i:
/* node.js */
> console.log("%i", 1234)
%i 1234
/* google chrome */
> console.log("%i", 1234)
1234
I think the fix is really simple: the relevant code is at https://github.com/nodejs/node/blob/master/lib/util.js#L86-L117 . Just adding the i case should be enough:
switch (f.charCodeAt(i + 1)) {
case 105: // 'i' <-- this is the new line, and it should appear just before the `d` case to make the fall through work
case 100: // 'd'
If it makes sense I can send a PR
Metadata
Metadata
Assignees
Labels
consoleIssues and PRs related to the console subsystem.Issues and PRs related to the console subsystem.feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.utilIssues and PRs related to the built-in util module.Issues and PRs related to the built-in util module.