diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2019-11-02 21:13:51 +0300 |
---|---|---|
committer | Myles Borins <mylesborins@google.com> | 2019-12-18 02:21:07 +0300 |
commit | f62a7679a30fb02739e6cba2206fbabe6372a332 (patch) | |
tree | 47ef5f796931e13f55639a7415fb73f584e84462 /doc/api | |
parent | f830a7dd7399c7558b39a9640c6868c17e05360b (diff) |
util: add Set and map size to inspect output
This adds the size of a set and map to the output. This aligns the
output with the one from Chromium.
PR-URL: https://github.com/nodejs/node/pull/30225
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'doc/api')
-rw-r--r-- | doc/api/util.md | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/doc/api/util.md b/doc/api/util.md index f4e689a2130..4727cdb88e9 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -576,7 +576,7 @@ console.log(util.inspect(o, { compact: true, depth: 5, breakLength: 80 })); // 'test', // 'foo' ] ], // 4 ], -// b: Map { 'za' => 1, 'zb' => 'test' } } +// b: Map(2) { 'za' => 1, 'zb' => 'test' } } // Setting `compact` to false changes the output to be more reader friendly. console.log(util.inspect(o, { compact: false, depth: 5, breakLength: 80 })); @@ -597,7 +597,7 @@ console.log(util.inspect(o, { compact: false, depth: 5, breakLength: 80 })); // ], // 4 // ], -// b: Map { +// b: Map(2) { // 'za' => 1, // 'zb' => 'test' // } @@ -639,9 +639,9 @@ const o1 = { c: new Set([2, 3, 1]) }; console.log(inspect(o1, { sorted: true })); -// { a: '`a` comes before `b`', b: [ 2, 3, 1 ], c: Set { 1, 2, 3 } } +// { a: '`a` comes before `b`', b: [ 2, 3, 1 ], c: Set(3) { 1, 2, 3 } } console.log(inspect(o1, { sorted: (a, b) => b.localeCompare(a) })); -// { c: Set { 3, 2, 1 }, b: [ 2, 3, 1 ], a: '`a` comes before `b`' } +// { c: Set(3) { 3, 2, 1 }, b: [ 2, 3, 1 ], a: '`a` comes before `b`' } const o2 = { c: new Set([2, 1, 3]), |