Commit 9960c761 authored by Takuya Noguchi's avatar Takuya Noguchi

Keep consistent in handling indexOf results

parent 7d15f36b
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
if (window.location.hash === DOWN_BUILD_TRACE) { if (window.location.hash === DOWN_BUILD_TRACE) {
$("html,body").scrollTop(this.$buildTrace.height()); $("html,body").scrollTop(this.$buildTrace.height());
} }
if (removeRefreshStatuses.indexOf(buildData.status) >= 0) { if (removeRefreshStatuses.indexOf(buildData.status) !== -1) {
this.$buildRefreshAnimation.remove(); this.$buildRefreshAnimation.remove();
return this.initScrollMonitor(); return this.initScrollMonitor();
} }
......
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
} }
GitLabDropdownFilter.prototype.shouldBlur = function(keyCode) { GitLabDropdownFilter.prototype.shouldBlur = function(keyCode) {
return BLUR_KEYCODES.indexOf(keyCode) >= 0; return BLUR_KEYCODES.indexOf(keyCode) !== -1;
}; };
GitLabDropdownFilter.prototype.filter = function(search_text) { GitLabDropdownFilter.prototype.filter = function(search_text) {
...@@ -605,7 +605,7 @@ ...@@ -605,7 +605,7 @@
var occurrences; var occurrences;
occurrences = fuzzaldrinPlus.match(text, term); occurrences = fuzzaldrinPlus.match(text, term);
return text.split('').map(function(character, i) { return text.split('').map(function(character, i) {
if (indexOf.call(occurrences, i) >= 0) { if (indexOf.call(occurrences, i) !== -1) {
return "<b>" + character + "</b>"; return "<b>" + character + "</b>";
} else { } else {
return character; return character;
...@@ -748,7 +748,7 @@ ...@@ -748,7 +748,7 @@
return function(e) { return function(e) {
var $listItems, PREV_INDEX, currentKeyCode; var $listItems, PREV_INDEX, currentKeyCode;
currentKeyCode = e.which; currentKeyCode = e.which;
if (ARROW_KEY_CODES.indexOf(currentKeyCode) >= 0) { if (ARROW_KEY_CODES.indexOf(currentKeyCode) !== -1) {
e.preventDefault(); e.preventDefault();
e.stopImmediatePropagation(); e.stopImmediatePropagation();
PREV_INDEX = currentIndex; PREV_INDEX = currentIndex;
......
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
formData = $.param(formData); formData = $.param(formData);
formAction = form.attr('action'); formAction = form.attr('action');
issuesUrl = formAction; issuesUrl = formAction;
issuesUrl += "" + (formAction.indexOf('?') < 0 ? '?' : '&'); issuesUrl += "" + (formAction.indexOf('?') === -1 ? '?' : '&');
issuesUrl += formData; issuesUrl += formData;
return gl.utils.visitUrl(issuesUrl); return gl.utils.visitUrl(issuesUrl);
}; };
......
...@@ -83,7 +83,7 @@ require('./smart_interval'); ...@@ -83,7 +83,7 @@ require('./smart_interval');
return function() { return function() {
var page; var page;
page = $('body').data('page').split(':').last(); page = $('body').data('page').split(':').last();
if (allowedPages.indexOf(page) < 0) { if (allowedPages.indexOf(page) === -1) {
return _this.clearEventListeners(); return _this.clearEventListeners();
} }
}; };
...@@ -233,7 +233,7 @@ require('./smart_interval'); ...@@ -233,7 +233,7 @@ require('./smart_interval');
} }
$('.ci_widget').hide(); $('.ci_widget').hide();
allowed_states = ["failed", "canceled", "running", "pending", "success", "success_with_warnings", "skipped", "not_found"]; allowed_states = ["failed", "canceled", "running", "pending", "success", "success_with_warnings", "skipped", "not_found"];
if (indexOf.call(allowed_states, state) >= 0) { if (indexOf.call(allowed_states, state) !== -1) {
$('.ci_widget.ci-' + state).show(); $('.ci_widget.ci-' + state).show();
switch (state) { switch (state) {
case "failed": case "failed":
......
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
var errorMessage, errors, formatter, unique, validator; var errorMessage, errors, formatter, unique, validator;
this.branchNameError.empty(); this.branchNameError.empty();
unique = function(values, value) { unique = function(values, value) {
if (indexOf.call(values, value) < 0) { if (indexOf.call(values, value) === -1) {
values.push(value); values.push(value);
} }
return values; return values;
......
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
if ($('input[name="ref"]').length) { if ($('input[name="ref"]').length) {
var $form = $dropdown.closest('form'); var $form = $dropdown.closest('form');
var action = $form.attr('action'); var action = $form.attr('action');
var divider = action.indexOf('?') < 0 ? '?' : '&'; var divider = action.indexOf('?') === -1 ? '?' : '&';
gl.utils.visitUrl(action + '' + divider + '' + $form.serialize()); gl.utils.visitUrl(action + '' + divider + '' + $form.serialize());
} }
} }
......
---
title: Keep consistent in handling indexOf results
merge_request: 9531
author: Takuya Noguchi
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment