More == -> === and != -> !== fixes

This commit is contained in:
rejas 2019-06-05 09:32:10 +02:00
parent 98a84c031e
commit 5c08bde0fa
14 changed files with 29 additions and 36 deletions

View File

@ -29,8 +29,8 @@
// Copy the properties over onto the new prototype
for (var name in prop) {
// Check if we're overwriting an existing function
prototype[name] = typeof prop[name] == "function" &&
typeof _super[name] == "function" && fnTest.test(prop[name]) ? (function (name, fn) {
prototype[name] = typeof prop[name] === "function" &&
typeof _super[name] === "function" && fnTest.test(prop[name]) ? (function (name, fn) {
return function () {
var tmp = this._super;

View File

@ -557,7 +557,7 @@ var MM = (function() {
})();
// Add polyfill for Object.assign.
if (typeof Object.assign != "function") {
if (typeof Object.assign !== "function") {
(function() {
Object.assign = function(target) {
"use strict";

View File

@ -164,7 +164,7 @@ var Module = Class.extend({
* @returns Nunjucks Environment
*/
nunjucksEnvironment: function() {
if (this._nunjucksEnvironment != null) {
if (this._nunjucksEnvironment !== null) {
return this._nunjucksEnvironment;
}

View File

@ -35,13 +35,13 @@ Module.register("alert",{
};
},
show_notification: function(message) {
if (this.config.effect == "slide") {this.config.effect = this.config.effect + "-" + this.config.position;}
if (this.config.effect === "slide") {this.config.effect = this.config.effect + "-" + this.config.position;}
msg = "";
if (message.title) {
msg += "<span class='thin dimmed medium'>" + message.title + "</span>";
}
if (message.message){
if (msg != ""){
if (msg !== ""){
msg+= "<br />";
}
msg += "<span class='light bright small'>" + message.message + "</span>";

View File

@ -224,7 +224,7 @@ Module.register("calendar", {
symbolWrapper.appendChild(symbol);
}
eventWrapper.appendChild(symbolWrapper);
}else if(this.config.timeFormat === "dateheaders"){
} else if(this.config.timeFormat === "dateheaders"){
var blankCell = document.createElement("td");
blankCell.innerHTML = "&nbsp;&nbsp;&nbsp;";
eventWrapper.appendChild(blankCell);
@ -261,7 +261,7 @@ Module.register("calendar", {
titleWrapper.colSpan = "2";
titleWrapper.align = "left";
}else{
} else {
var timeClass = this.timeClassForUrl(event.url);
var timeWrapper = document.createElement("td");
@ -274,7 +274,7 @@ Module.register("calendar", {
}
eventWrapper.appendChild(titleWrapper);
}else{
} else {
var timeWrapper = document.createElement("td");
eventWrapper.appendChild(titleWrapper);
@ -530,7 +530,6 @@ Module.register("calendar", {
return events.slice(0, this.config.maximumEntries);
},
listContainsEvent: function(eventList, event){
for(var evt of eventList){
if(evt.title === event.title && parseInt(evt.startDate) === parseInt(event.startDate)){
@ -538,7 +537,6 @@ Module.register("calendar", {
}
}
return false;
},
/* createEventList(url)
@ -718,7 +716,6 @@ Module.register("calendar", {
* Capitalize the first letter of a string
* Return capitalized string
*/
capFirst: function (string) {
return string.charAt(0).toUpperCase() + string.slice(1);
},

View File

@ -39,7 +39,7 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri
bearer: auth.pass
}
}else{
} else {
opts.auth = {
user: auth.user,
pass: auth.pass
@ -47,7 +47,7 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri
if(auth.method === "digest"){
opts.auth.sendImmediately = false;
}else{
} else {
opts.auth.sendImmediately = true;
}
}
@ -107,7 +107,6 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri
}
}
// calculate the duration f the event for use with recurring events.
var duration = parseInt(endDate.format("x")) - parseInt(startDate.format("x"));
@ -176,7 +175,7 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri
var geo = event.geo || false;
var description = event.description || false;
if (typeof event.rrule != "undefined" && event.rrule != null && !isFacebookBirthday) {
if (typeof event.rrule !== undefined && event.rrule !== null && !isFacebookBirthday) {
var rule = event.rrule;
// can cause problems with e.g. birthdays before 1900
@ -341,7 +340,7 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri
} else {
return title.includes(filter);
}
}
};
/* public methods */
@ -395,8 +394,6 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri
this.events = function() {
return events;
};
};
module.exports = CalendarFetcher;

View File

@ -214,7 +214,7 @@ vows.describe('node-ical').addBatch({
, 'event with rrule' :{
topic: function(events){
return _.select(_.values(events), function(x){
return x.summary == "foobarTV broadcast starts"
return x.summary === "foobarTV broadcast starts"
})[0];
}
, "Has an RRULE": function(topic){
@ -272,7 +272,7 @@ vows.describe('node-ical').addBatch({
},
'grabbing custom properties': {
topic: function(topic) {
}
}
},

View File

@ -136,7 +136,7 @@ Module.register("clock",{
clockCircle.style.width = this.config.analogSize;
clockCircle.style.height = this.config.analogSize;
if (this.config.analogFace != "" && this.config.analogFace != "simple" && this.config.analogFace != "none") {
if (this.config.analogFace !== "" && this.config.analogFace !== "simple" && this.config.analogFace !== "none") {
clockCircle.style.background = "url("+ this.data.path + "faces/" + this.config.analogFace + ".svg)";
clockCircle.style.backgroundSize = "100%";
@ -144,7 +144,7 @@ Module.register("clock",{
// clockCircle.style.border = "1px solid black";
clockCircle.style.border = "rgba(0, 0, 0, 0.1)"; //Updated fix for Issue 611 where non-black backgrounds are used
} else if (this.config.analogFace != "none") {
} else if (this.config.analogFace !== "none") {
clockCircle.style.border = "2px solid white";
}
var clockFace = document.createElement("div");

View File

@ -54,7 +54,7 @@ Module.register("compliments", {
this.lastComplimentIndex = -1;
var self = this;
if (this.config.remoteFile != null) {
if (this.config.remoteFile !== null) {
this.complimentFile(function(response) {
self.config.compliments = JSON.parse(response);
self.updateDom();
@ -134,7 +134,7 @@ Module.register("compliments", {
xobj.overrideMimeType("application/json");
xobj.open("GET", path, true);
xobj.onreadystatechange = function() {
if (xobj.readyState == 4 && xobj.status == "200") {
if (xobj.readyState === 4 && xobj.status === 200) {
callback(xobj.responseText);
}
};
@ -194,7 +194,7 @@ Module.register("compliments", {
// Override notification handler.
notificationReceived: function(notification, payload, sender) {
if (notification == "CURRENTWEATHER_DATA") {
if (notification === "CURRENTWEATHER_DATA") {
this.setCurrentWeatherType(payload.data);
}
},

View File

@ -8,7 +8,6 @@ Module.register("updatenotification", {
start: function () {
Log.log("Start updatenotification");
},
notificationReceived: function (notification, payload, sender) {
@ -58,14 +57,14 @@ Module.register("updatenotification", {
icon.innerHTML = "&nbsp;";
message.appendChild(icon);
var updateInfoKeyName = this.status.behind == 1 ? "UPDATE_INFO_SINGLE" : "UPDATE_INFO_MULTIPLE";
var updateInfoKeyName = this.status.behind === 1 ? "UPDATE_INFO_SINGLE" : "UPDATE_INFO_MULTIPLE";
var subtextHtml = this.translate(updateInfoKeyName, {
COMMIT_COUNT: this.status.behind,
BRANCH_NAME: this.status.current
});
var text = document.createElement("span");
if (this.status.module == "default") {
if (this.status.module === "default") {
text.innerHTML = this.translate("UPDATE_NOTIFICATION");
subtextHtml = this.diffLink(subtextHtml);
} else {

View File

@ -9,7 +9,7 @@
{{ current.windSpeed | round }}
{% endif %}
{% if config.showWindDirection %}
<sup>
<sup>
{% if config.showWindDirectionAsArrow %}
<i class="fa fa-long-arrow-up" style="transform:rotate({{ current.windDirection }}deg);"></i>
{% else %}
@ -24,7 +24,7 @@
{% endif %}
<span class="wi dimmed wi-{{ current.nextSunAction() }}"></span>
<span>
{% if current.nextSunAction() == "sunset" %}
{% if current.nextSunAction() === "sunset" %}
{{ current.sunset | formatTime }}
{% else %}
{{ current.sunrise | formatTime }}

View File

@ -86,9 +86,9 @@ WeatherProvider.register("openweathermap", {
*/
generateWeatherObjectsFromForecast(forecasts) {
if (this.config.weatherEndpoint == "/forecast") {
if (this.config.weatherEndpoint === "/forecast") {
return this.fetchForecastHourly(forecasts);
} else if (this.config.weatherEndpoint == "/forecast/daily") {
} else if (this.config.weatherEndpoint === "/forecast/daily") {
return this.fetchForecastDaily(forecasts);
}
// if weatherEndpoint does not match forecast or forecast/daily, what should be returned?
@ -140,7 +140,7 @@ WeatherProvider.register("openweathermap", {
weather.weatherType = this.convertWeatherType(forecast.weather[0].icon);
}
if (moment(forecast.dt, "X").format("H") >= 8 && moment(forecast.dt, "X").format("H") <= 17) {
weather.weatherType = this.convertWeatherType(forecast.weather[0].icon);
}

View File

@ -261,7 +261,7 @@ Module.register("weatherforecast",{
} else if (this.status === 401) {
self.updateDom(self.config.animationSpeed);
if (self.config.forecastEndpoint == "forecast/daily") {
if (self.config.forecastEndpoint === "forecast/daily") {
self.config.forecastEndpoint = "forecast";
Log.warn(self.name + ": Your AppID does not support long term forecasts. Switching to fallback endpoint.");
}

View File

@ -13,7 +13,7 @@ describe("All font files from roboto.css should be downloadable", function() {
var fileContent = require("fs").readFileSync(__dirname + "/../../fonts/roboto.css", "utf8");
var regex = /\burl\(['"]([^'"]+)['"]\)/g;
var match = regex.exec(fileContent);
while (match != null) {
while (match !== null) {
// Push 1st match group onto fontFiles stack
fontFiles.push(match[1]);
// Find the next one