Permalink
Browse files

Merge pull request #295 from oliverklee/task/strict-comparisons

[TASK] Always use strict comparisons
  • Loading branch information...
2 parents 39244e6 + 018b55e commit 5d7b7743503bd6fc11df3657bc277e3f795afbf1 @rmm5t committed on GitHub Jun 25, 2016
View
@@ -192,7 +192,7 @@
var data = prepareData(this);
if (!isNaN(data.datetime)) {
- if ( $s.cutoff == 0 || Math.abs(distance(data.datetime)) < $s.cutoff) {
+ if ( $s.cutoff === 0 || Math.abs(distance(data.datetime)) < $s.cutoff) {
$(this).text(inWords(data.datetime));
} else {
if ($(this).attr('title').length > 0) {
@@ -1,6 +1,6 @@
(function() {
function numpf(n, a) {
- return a[plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5];
+ return a[plural=n===0 ? 0 : n===1 ? 1 : n===2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5];
}
jQuery.timeago.settings.strings = {
@@ -1,7 +1,7 @@
// Czech
(function() {
function f(n, d, a) {
- return a[d>=0 ? 0 : a.length==2 || n<5 ? 1 : 2];
+ return a[d>=0 ? 0 : a.length===2 || n<5 ? 1 : 2];
}
jQuery.timeago.settings.strings = {
@@ -6,11 +6,11 @@ jQuery.timeago.settings.strings = {
minute: "דקה",
minutes: "%d דקות",
hour: "שעה",
- hours: function(number){return (number==2) ? "שעתיים" : "%d שעות";},
+ hours: function(number){return (number===2) ? "שעתיים" : "%d שעות";},
day: "יום",
- days: function(number){return (number==2) ? "יומיים" : "%d ימים";},
+ days: function(number){return (number===2) ? "יומיים" : "%d ימים";},
month: "חודש",
- months: function(number){return (number==2) ? "חודשיים" : "%d חודשים";},
+ months: function(number){return (number===2) ? "חודשיים" : "%d חודשים";},
year: "שנה",
- years: function(number){return (number==2) ? "שנתיים" : "%d שנים";}
+ years: function(number){return (number===2) ? "שנתיים" : "%d שנים";}
};
@@ -5,7 +5,7 @@
// s - 2-4, 22-24, 32-34 ...
// t - 5-20, 25-30, ...
var n10 = n % 10;
- if ( (n10 == 1) && ( (n == 1) || (n > 20) ) ) {
+ if ( (n10 === 1) && ( (n === 1) || (n > 20) ) ) {
return f;
} else if ( (n10 > 1) && (n10 < 5) && ( (n > 20) || (n < 10) ) ) {
return s;
@@ -5,7 +5,7 @@
// s - 2-4, 22-24, 32-34 ...
// t - 5-20, 25-30, ...
var n10 = n % 10;
- if ( (n10 == 1) && ( (n == 1) || (n > 20) ) ) {
+ if ( (n10 === 1) && ( (n === 1) || (n > 20) ) ) {
return f;
} else if ( (n10 > 1) && (n10 < 5) && ( (n > 20) || (n < 10) ) ) {
return s;
@@ -2,7 +2,7 @@
(function () {
var numpf;
numpf = function (n, a) {
- return a[n%100==1 ? 1 : n%100==2 ? 2 : n%100==3 || n%100==4 ? 3 : 0];
+ return a[n%100===1 ? 1 : n%100===2 ? 2 : n%100===3 || n%100===4 ? 3 : 0];
};
jQuery.timeago.settings.strings = {
@@ -5,7 +5,7 @@
// s - 2-4, 22-24, 32-34 ...
// t - 5-20, 25-30, ...
var n10 = n % 10;
- if ( (n10 == 1) && ( (n == 1) || (n > 20) ) ) {
+ if ( (n10 === 1) && ( (n === 1) || (n > 20) ) ) {
return f;
} else if ( (n10 > 1) && (n10 < 5) && ( (n > 20) || (n < 10) ) ) {
return s;
View
@@ -362,11 +362,11 @@
module("Tooltip");
test("should set title to original text contents", function () {
- ok($("#testTooltip").attr("title") == "February 26th", "correctly set");
+ ok($("#testTooltip").attr("title") === "February 26th", "correctly set");
});
test("should leave title alone if no text text content", function () {
- ok($("#defaultTooltip").attr("title") == "2008-02-26", "correctly set");
+ ok($("#defaultTooltip").attr("title") === "2008-02-26", "correctly set");
});
test("should preserve title in time tags", function () {
@@ -60,7 +60,7 @@ function loadRussian() {
// s - 2-4, 22-24, 32-34 ...
// t - 5-20, 25-30, ...
var n10 = n % 10;
- if ( (n10 == 1) && ( (n == 1) || (n > 20) ) ) {
+ if ( (n10 === 1) && ( (n === 1) || (n > 20) ) ) {
return f;
} else if ( (n10 > 1) && (n10 < 5) && ( (n > 20) || (n < 10) ) ) {
return s;

0 comments on commit 5d7b774

Please sign in to comment.