diff --git a/lib/sinon/assert.js b/lib/sinon/assert.js index f7e0e35c1..372646f6a 100644 --- a/lib/sinon/assert.js +++ b/lib/sinon/assert.js @@ -157,7 +157,7 @@ assert = { var o = options || {}; var prefix = typeof o.prefix === "undefined" && "assert" || o.prefix; - var includeFail = typeof o.includeFail === "undefined" || !!o.includeFail; + var includeFail = typeof o.includeFail === "undefined" || Boolean(o.includeFail); var instance = this; forEach(Object.keys(instance), function (method) { diff --git a/lib/sinon/blob.js b/lib/sinon/blob.js index 78a5dd8ba..8f386d231 100644 --- a/lib/sinon/blob.js +++ b/lib/sinon/blob.js @@ -3,7 +3,7 @@ exports.isSupported = (function () { try { - return !!new Blob(); + return Boolean(new Blob()); } catch (e) { return false; } diff --git a/lib/sinon/call.js b/lib/sinon/call.js index 4fdce5b0a..97435612c 100644 --- a/lib/sinon/call.js +++ b/lib/sinon/call.js @@ -77,7 +77,7 @@ var callProto = { threw: function threw(error) { if (typeof error === "undefined" || !this.exception) { - return !!this.exception; + return Boolean(this.exception); } return this.exception === error || this.exception.name === error; diff --git a/lib/sinon/match.js b/lib/sinon/match.js index a7044d1d5..81434f031 100644 --- a/lib/sinon/match.js +++ b/lib/sinon/match.js @@ -177,7 +177,7 @@ match.defined = match(function (actual) { }, "defined"); match.truthy = match(function (actual) { - return !!actual; + return Boolean(actual); }, "truthy"); match.falsy = match(function (actual) { @@ -279,7 +279,7 @@ match.every = function (predicate) { }); } - return !!actual && typeOf(actual.forEach) === "function" && every(actual, function (element) { + return Boolean(actual) && typeOf(actual.forEach) === "function" && every(actual, function (element) { return predicate.test(element); }); }, "every(" + predicate.message + ")"); @@ -297,7 +297,7 @@ match.some = function (predicate) { }); } - return !!actual && typeOf(actual.forEach) === "function" && !every(actual, function (element) { + return Boolean(actual) && typeOf(actual.forEach) === "function" && !every(actual, function (element) { return !predicate.test(element); }); }, "some(" + predicate.message + ")"); diff --git a/lib/sinon/util/core/wrap-method.js b/lib/sinon/util/core/wrap-method.js index 811b95444..55ea77001 100644 --- a/lib/sinon/util/core/wrap-method.js +++ b/lib/sinon/util/core/wrap-method.js @@ -5,7 +5,7 @@ var hasOwnProperty = require("@sinonjs/commons").prototypes.object.hasOwnPropert var valueToString = require("@sinonjs/commons").valueToString; function isFunction(obj) { - return typeof obj === "function" || !!(obj && obj.constructor && obj.call && obj.apply); + return typeof obj === "function" || Boolean(obj && obj.constructor && obj.call && obj.apply); } function mirrorProperties(target, source) { diff --git a/test/sandbox-test.js b/test/sandbox-test.js index 3ba146880..05b33c819 100644 --- a/test/sandbox-test.js +++ b/test/sandbox-test.js @@ -19,7 +19,7 @@ var sinonAssert = require("../lib/sinon/assert"); var sinonClock = require("../lib/sinon/util/fake_timers"); var supportsAjax = typeof XMLHttpRequest !== "undefined" || typeof ActiveXObject !== "undefined"; -var supportPromise = !!global.Promise; +var supportPromise = Boolean(global.Promise); var globalXHR = global.XMLHttpRequest; var globalAXO = global.ActiveXObject; diff --git a/test/util/fake-timers-test.js b/test/util/fake-timers-test.js index 7df6685e5..b52f1c8c4 100644 --- a/test/util/fake-timers-test.js +++ b/test/util/fake-timers-test.js @@ -1016,8 +1016,8 @@ describe("fakeTimers.clock", function () { it("fake Date constructor should mirror Date's properties", function () { this.clock = fakeTimers.useFakeTimers(0); - assert(!!Date.parse); - assert(!!Date.UTC); + assert(Boolean(Date.parse)); + assert(Boolean(Date.UTC)); }); it("decide on Date.now support at call-time when supported", function () {