Skip to content

Commit

Permalink
doc: update util.format formatters documentation
Browse files Browse the repository at this point in the history
This includes the information that some inputs are handled
differently than others (e.g., `Symbols` are partially represented
as `NaN`).

PR-URL: #27621
Reviewed-By: Roman Reiss <me@silverwind.io>
  • Loading branch information
BridgeAR authored and targos committed May 20, 2019
1 parent 5205902 commit 378f44c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions doc/api/util.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,15 @@ as a `printf`-like format string which can contain zero or more format
specifiers. Each specifier is replaced with the converted value from the
corresponding argument. Supported specifiers are:

* `%s` - `String` will be used to convert all values except `BigInt` and
`Object`. `BigInt` values will be represented with an `n` and Objects are
* `%s` - `String` will be used to convert all values except `BigInt`, `Object`
and `-0`. `BigInt` values will be represented with an `n` and Objects are
inspected using `util.inspect()` with options
`{ depth: 0, colors: false, compact: 3 }`.
* `%d` - `Number` will be used to convert all values except `BigInt`.
* `%i` - `parseInt(value, 10)` is used for all values except `BigInt`.
* `%f` - `parseFloat(value)` is used for all values.
`{ depth: 0, colors: false, compact: 3 }`.
* `%d` - `Number` will be used to convert all values except `BigInt` and
`Symbol`.
* `%i` - `parseInt(value, 10)` is used for all values except `BigInt` and
`Symbol`.
* `%f` - `parseFloat(value)` is used for all values expect `Symbol`.
* `%j` - JSON. Replaced with the string `'[Circular]'` if the argument contains
circular references.
* `%o` - `Object`. A string representation of an object with generic JavaScript
Expand Down

0 comments on commit 378f44c

Please sign in to comment.