Skip to content

Commit

Permalink
[Refactor] use !! over Boolean()
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jun 29, 2019
1 parent 838d995 commit 32b5948
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/test.js
Expand Up @@ -202,11 +202,11 @@ Test.prototype._assert = function assert(ok, opts) {
var self = this;
var extra = opts.extra || {};

ok = Boolean(ok) || Boolean(extra.skip);
ok = !!ok || !!extra.skip;

var res = {
id: self.assertCount++,
ok: Boolean(ok),
ok: ok,
skip: defined(extra.skip, opts.skip),
todo: defined(extra.todo, opts.todo, self._todo),
name: defined(extra.message, opts.message, '(unnamed assert)'),
Expand All @@ -219,7 +219,7 @@ Test.prototype._assert = function assert(ok, opts) {
if (has(opts, 'expected') || has(extra, 'expected')) {
res.expected = defined(extra.expected, opts.expected);
}
this._ok = Boolean(this._ok && ok);
this._ok = !!(this._ok && ok);

if (!ok && !res.todo) {
res.error = defined(extra.error, opts.error, new Error(res.name));
Expand Down

0 comments on commit 32b5948

Please sign in to comment.