util: fix formatting of objects with SIMD enabled · nodejs/node@0a07201 · GitHub
Skip to content

Commit 0a07201

Browse files
addaleaxcjihrig
authored andcommitted
util: fix formatting of objects with SIMD enabled
When SIMD is enabled, `util.format` couldn’t display objects (with at least 1 key) because the formatter function got overridden. PR-URL: #7864 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
1 parent a4f0b13 commit 0a07201

3 files changed

Lines changed: 17 additions & 4 deletions

File tree

lib/util.js

Lines changed: 6 additions & 4 deletions

test/parallel/test-util-format.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ const symbol = Symbol('foo');
77
assert.equal(util.format(), '');
88
assert.equal(util.format(''), '');
99
assert.equal(util.format([]), '[]');
10+
assert.equal(util.format([0]), '[ 0 ]');
1011
assert.equal(util.format({}), '{}');
12+
assert.equal(util.format({foo: 42}), '{ foo: 42 }');
1113
assert.equal(util.format(null), 'null');
1214
assert.equal(util.format(true), 'true');
1315
assert.equal(util.format(false), 'false');

test/parallel/test-util-inspect-simd.js

Lines changed: 9 additions & 0 deletions

0 commit comments

Comments
 (0)