Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
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.
  • Loading branch information
addaleax committed Jul 25, 2016
commit 5e012081f469137e2072e1f7877d4558991323f8
3 changes: 2 additions & 1 deletion lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,8 +489,9 @@ function formatValue(ctx, value, recurseTimes) {
}
} else if (simdFormatters &&
typeof value.constructor === 'function' &&
(formatter = simdFormatters.get(value.constructor))) {
simdFormatters.has(value.constructor)) {
braces = ['[', ']'];
formatter = simdFormatters.get(value.constructor);
} else {
var promiseInternals = inspectPromise(value);
if (promiseInternals) {
Expand Down
2 changes: 2 additions & 0 deletions test/parallel/test-util-format.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ const symbol = Symbol('foo');
assert.equal(util.format(), '');
assert.equal(util.format(''), '');
assert.equal(util.format([]), '[]');
assert.equal(util.format([0]), '[ 0 ]');
assert.equal(util.format({}), '{}');
assert.equal(util.format({foo: 42}), '{ foo: 42 }');
assert.equal(util.format(null), 'null');
assert.equal(util.format(true), 'true');
assert.equal(util.format(false), 'false');
Expand Down