Skip to content

Commit

Permalink
doc: add single arg scenario for util.format
Browse files Browse the repository at this point in the history
Set the expected outcome of `util.format('%%')` to be `%%`
instead of `%`.

PR-URL: nodejs/node#12374
Fixes: nodejs/node#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>
  • Loading branch information
tarunbatra authored and andrew749 committed Jul 19, 2017
1 parent 9e3ccf5 commit 8fd5c73
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions doc/api/util.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,13 @@ Each argument is converted to a string using `util.inspect()`.
util.format(1, 2, 3); // '1 2 3'
```

If only one argument is passed to `util.format()`, it is returned as it is
without any formatting.

```js
util.format('%% %s'); // '%% %s'
```

## util.inherits(constructor, superConstructor)
<!-- YAML
added: v0.3.0
Expand Down

0 comments on commit 8fd5c73

Please sign in to comment.