From 78af0df25ed803a59ba39cd7c869bac8d87f0548 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 `%`. PR-URL: https://github.com/nodejs/node/pull/12374 Fixes: https://github.com/nodejs/node/issues/12362 Reviewed-By: Benjamin Gruenbaum Reviewed-By: Rich Trott Reviewed-By: Refael Ackermann Reviewed-By: Vse Mozhet Byt Reviewed-By: Alexey Orlenko Reviewed-By: Evan Lucas Reviewed-By: Colin Ihrig --- 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)