replace indexOf with includes where possible

This commit is contained in:
2023-01-05 08:51:31 -06:00
parent a7256ba894
commit 778173b118
7 changed files with 29 additions and 86 deletions
+1 -1
View File
@@ -118,7 +118,7 @@ function searchBonjour(pluginType, pluginConfig) {
bonjour.find({ type: pluginConfig.searchOptions.bonjourName }, (e) => {
const validAddresses = [];
e.addresses.forEach((address) => {
if (address.indexOf(':') === -1) {
if (!address.includes(':')) {
validAddresses.push(address);
}
});
+2 -2
View File
@@ -144,7 +144,7 @@ function switchDevice(id) {
if (pinnedDevices.length > 0) {
cols += pinnedDevices.length;
}
if (pinnedDevices.indexOf(activeDevice) >= 0 || id === undefined) {
if (pinnedDevices.includes(activeDevice) || id === undefined) {
cols--;
}
@@ -229,7 +229,7 @@ module.exports.pinActiveDevice = function pinActiveDevice() {
if (activeDevice === undefined) {
return;
}
if (pinnedDevices.indexOf(DEVICE.all[activeDevice.id]) === -1) {
if (!pinnedDevices.includes(DEVICE.all[activeDevice.id])) {
pinnedDevices.push(DEVICE.all[activeDevice.id]);
}
DEVICE.changeActivePinIndex(true);