Skip to content

Commit ed13016

Browse files
tarunbatraevanlucas
authored andcommitted
doc: add single arg scenario for util.format
Set the expected outcome of `util.format('%%')` to be `%%` instead of `%`. PR-URL: #12374 Fixes: #12362 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent aa51105 commit ed13016

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

doc/api/util.md

+7
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,13 @@ Each argument is converted to a string using `util.inspect()`.
135135
util.format(1, 2, 3); // '1 2 3'
136136
```
137137

138+
If only one argument is passed to `util.format()`, it is returned as it is
139+
without any formatting.
140+
141+
```js
142+
util.format('%% %s'); // '%% %s'
143+
```
144+
138145
## util.inherits(constructor, superConstructor)
139146
<!-- YAML
140147
added: v0.3.0

0 commit comments

Comments
 (0)