From c1b9be53c89a7ac11c01905a4477785a6154512b Mon Sep 17 00:00:00 2001 From: Roman Reiss Date: Sat, 29 Sep 2018 14:41:36 +0200 Subject: [PATCH] util: treat format arguments equally Two changes here which bring us closer to the console standard: - Arguments to `util.format` are no longer formatted differently depending on their order, with format strings being an exception. - Format specifier formatting is now only triggered if the string actually contains a format string. Under the hood, we now use a single shared function to format the given arguments which will make the code easier to read and modify. PR-URL: https://github.com/nodejs/node/pull/23162 Fixes: https://github.com/nodejs/node/issues/23137 Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: Refael Ackermann --- doc/api/util.md | 50 +++++---- lib/util.js | 179 ++++++++++++++++-------------- test/parallel/test-util-format.js | 16 +++ 3 files changed, 144 insertions(+), 101 deletions(-) diff --git a/doc/api/util.md b/doc/api/util.md index c1fc606a517..3def79546b6 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -183,6 +183,17 @@ property take precedence over `--trace-deprecation` and