From 8fd5c732c2d166e2a5db8319ac39d771ea8afaa7 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 3843f80ce75..28ceac1c54d 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -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)