Skip to content

Commit

Permalink
Fix lint violations for no-implicit-coercion
Browse files Browse the repository at this point in the history
  • Loading branch information
mroderick committed Oct 8, 2018
1 parent 6e63ba8 commit 6204505
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/sinon/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion lib/sinon/blob.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

exports.isSupported = (function () {
try {
return !!new Blob();
return Boolean(new Blob());
} catch (e) {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/sinon/call.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions lib/sinon/match.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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 + ")");
Expand All @@ -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 + ")");
Expand Down
2 changes: 1 addition & 1 deletion lib/sinon/util/core/wrap-method.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion test/sandbox-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions test/util/fake-timers-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down

0 comments on commit 6204505

Please sign in to comment.