From 636302f428bb277dc5f1c5d1801eead4b5e72752 Mon Sep 17 00:00:00 2001 From: Tarun Batra Date: Thu, 13 Apr 2017 02:42:02 +0530 Subject: [PATCH] doc: add single arg scenario for util.format Set the expected outcome of `util.format('%%')` to be `%%` instead of `%`. Fixes: https://github.com/nodejs/node/issues/12362 --- doc/api/util.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/api/util.md b/doc/api/util.md index 357811cc0fcdeb..8dcc1179381f84 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -135,6 +135,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)