Skip to content

Commit

Permalink
Cleanup for #266
Browse files Browse the repository at this point in the history
  • Loading branch information
hueniverse committed Mar 12, 2020
1 parent 7e4dcd2 commit 703ba07
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ exports.Boom = class extends Error {

exports.isBoom = function (err, statusCode) {

return err instanceof Error && !!err.isBoom && (statusCode ? err.output.statusCode === statusCode : true);
return err instanceof Error && !!err.isBoom && (!statusCode || err.output.statusCode === statusCode);
};


Expand Down
2 changes: 2 additions & 0 deletions test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ expect.type<boolean>(Boom.boomify(error).isBoom);
// isBoom()

expect.type<boolean>(Boom.isBoom(error));
expect.type<boolean>(Boom.isBoom(error, 404));
expect.type<boolean>(Boom.isBoom(Boom.boomify(error)));

expect.error(Boom.isBoom(error, 'test'));
expect.error(Boom.isBoom('error'));
expect.error(Boom.isBoom({ foo: 'bar' }));
expect.error(Boom.isBoom({ error: true }));
Expand Down

0 comments on commit 703ba07

Please # to comment.