From 9e5ccb0c06f0603f6028dd772152ac0be49ecf46 Mon Sep 17 00:00:00 2001 From: Roman Reiss Date: Sat, 29 Sep 2018 14:41:36 +0200 Subject: [PATCH 1/2] 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 --- doc/api/util.md | 48 +++++--- lib/util.js | 181 ++++++++++++++++-------------- 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 c1fc606a51732e..c35c9b7d869608 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -183,6 +183,17 @@ property take precedence over `--trace-deprecation` and