From 68eaa8789a32cb73c31fab7d7c1d0ab7ab7ea729 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Mon, 10 Sep 2018 08:55:00 +0200 Subject: [PATCH] util: add order option to `.inspect()` The order option can be used to sort the inspected values in case they do not rely on their order as arrays. That way the output is stable no matter of the object property inspection order. Backport-PR-URL: https://github.com/nodejs/node/pull/23039 PR-URL: https://github.com/nodejs/node/pull/22788 Refs: https://github.com/nodejs/node/issues/22763 Reviewed-By: John-David Dalton Reviewed-By: Anna Henningsen Reviewed-By: Trivikram Kamat --- doc/api/util.md | 38 +++++++++++++++++++++++++++++- lib/util.js | 19 ++++++++++++--- test/parallel/test-util-inspect.js | 30 +++++++++++++++++++++++ 3 files changed, 83 insertions(+), 4 deletions(-) diff --git a/doc/api/util.md b/doc/api/util.md index 8dfbfd874c762a..592e39bb442183 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -360,6 +360,9 @@ stream.write('With ES6');