Merge pull request #1372 from pi-hole/indexOf

Always use `!== -1` to check for a string's existence
This commit is contained in:
DL6ER
2020-05-25 20:42:02 +02:00
committed by GitHub
5 changed files with 12 additions and 12 deletions

View File

@@ -470,7 +470,7 @@ function updateForwardDestinationsPie() {
// Collect values and colors
$.each(data.forward_destinations, function (key, value) {
if (key.indexOf("|") > -1) {
if (key.indexOf("|") !== -1) {
key = key.substr(0, key.indexOf("|"));
}
@@ -559,7 +559,7 @@ function updateTopClientsChart() {
}
client = escapeHtml(client);
if (client.indexOf("|") > -1) {
if (client.indexOf("|") !== -1) {
idx = client.indexOf("|");
clientname = client.substr(0, idx);
clientip = client.substr(idx + 1, client.length - idx);
@@ -605,7 +605,7 @@ function updateTopClientsChart() {
}
client = escapeHtml(client);
if (client.indexOf("|") > -1) {
if (client.indexOf("|") !== -1) {
idx = client.indexOf("|");
clientname = client.substr(0, idx);
clientip = client.substr(idx + 1, client.length - idx);