Skip to content

Commit

Permalink
[Fix] inspect(Object(-0)) should be “Object(-0)”, not “Object(0)”
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Dec 20, 2017
1 parent 5ce2c77 commit d0a031f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ module.exports = function inspect_ (obj, opts, depth, seen) {
return collectionOf('Set', setSize.call(obj), parts);
}
if (isNumber(obj)) {
return markBoxed(Number(obj));
return markBoxed(inspect(Number(obj)));
}
if (isBoolean(obj)) {
return markBoxed(booleanValueOf.call(obj));
Expand Down
8 changes: 6 additions & 2 deletions test/number.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ var inspect = require('../');
var test = require('tape');

test('negative zero', function (t) {
t.equal(inspect(0), '0');
t.equal(inspect(-0), '-0');
t.equal(inspect(0), '0', 'inspect(0) === "0"');
t.equal(inspect(Object(0)), 'Object(0)', 'inspect(Object(0)) === "Object(0)"');

t.equal(inspect(-0), '-0', 'inspect(-0) === "-0"');
t.equal(inspect(Object(-0)), 'Object(-0)', 'inspect(Object(-0)) === "Object(-0)"');

t.end();
});

0 comments on commit d0a031f

Please sign in to comment.