Commit ccd0ca98 by Johannes Edmeier

Polish: use includes() instead indexOf() where possible

parent 5be42a58
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -13,7 +13,7 @@
"@fortawesome/fontawesome-free-brands": "^5.0.13",
"@fortawesome/fontawesome-free-regular": "^5.0.13",
"@fortawesome/fontawesome-free-solid": "^5.0.13",
"@fortawesome/vue-fontawesome": "0.0.22",
"@fortawesome/vue-fontawesome": "0.0.23",
"axios": "^0.18.0",
"bulma": "^0.7.1",
"bulma-badge": "^1.0.1",
......@@ -27,12 +27,12 @@
"event-source-polyfill": "0.0.12",
"linkifyjs": "^2.1.6",
"lodash": "^4.17.10",
"moment": "^2.22.1",
"moment": "^2.22.2",
"moment-shortformat": "^2.1.0",
"popper.js": "^1.14.3",
"pretty-bytes": "^5.0.0",
"pretty-bytes": "^5.1.0",
"resize-observer-polyfill": "^1.5.0",
"rxjs": "^5.5.10",
"rxjs": "^5.5.11",
"vue": "^2.5.16",
"vue-clickaway": "^2.2.1",
"vue-router": "^3.0.1",
......@@ -40,17 +40,17 @@
},
"devDependencies": {
"@vue/test-utils": "^1.0.0-beta.16",
"autoprefixer": "^8.5.0",
"autoprefixer": "^8.6.1",
"babel-core": "^6.26.3",
"babel-eslint": "^8.2.3",
"babel-jest": "^22.4.3",
"babel-jest": "^23.0.1",
"babel-loader": "^7.1.4",
"babel-plugin-lodash": "^3.3.2",
"babel-plugin-lodash": "^3.3.3",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.7.0",
"babel-preset-stage-2": "^6.24.1",
"clean-webpack-plugin": "^0.1.19",
"cross-env": "^5.1.5",
"cross-env": "^5.1.6",
"css-hot-loader": "^1.3.9",
"css-loader": "^0.28.11",
"css-mqpacker": "^6.0.2",
......@@ -64,7 +64,7 @@
"html-loader": "^0.5.5",
"html-webpack-plugin": "^2.30.0",
"identity-obj-proxy": "^3.0.0",
"jest": "^22.4.3",
"jest": "^23.1.0",
"lodash-webpack-plugin": "^0.11.5",
"node-sass": "^4.9.0",
"optimize-css-assets-webpack-plugin": "^3.2.0",
......@@ -72,12 +72,12 @@
"sass-loader": "^6.0.7",
"style-loader": "^0.20.3",
"url-loader": "^0.6.2",
"vue-jest": "^2.5.0",
"vue-loader": "^14.2.2",
"vue-jest": "^2.6.0",
"vue-loader": "^14.2.3",
"vue-svg-loader": "^0.5.0",
"vue-template-compiler": "^2.5.16",
"webpack": "^3.12.0",
"webpack-bundle-analyzer": "^2.12.0"
"webpack-bundle-analyzer": "^2.13.1"
},
"browserslist": [
"> 2%",
......
......@@ -88,7 +88,7 @@ class Instance {
async hasEnvManagerSupport() {
const response = await axios.options(uri`instances/${this.id}/actuator/env`);
return response.headers['allow'] && response.headers['allow'].indexOf('POST') >= 0;
return response.headers['allow'] && response.headers['allow'].includes('POST');
}
async resetEnv() {
......
......@@ -56,7 +56,7 @@ class NotificationFilter {
static async isSupported() {
try {
const response = await axios.options('notifications/filters');
return response.headers['allow'] && response.headers['allow'].indexOf('POST') >= 0;
return response.headers['allow'] && response.headers['allow'].includes('POST');
} catch (error) {
return false;
}
......
......@@ -58,11 +58,11 @@
}
isSuccess() {
return this.type.toLowerCase().indexOf('success') >= 0;
return this.type.toLowerCase().includes('success');
}
isFailure() {
return this.type.toLowerCase().indexOf('failure') >= 0;
return this.type.toLowerCase().includes('failure');
}
}
......
......@@ -130,7 +130,7 @@
},
methods: {
hasMetric(metric) {
return this.metrics.indexOf(metric) >= 0;
return this.metrics.includes(metric);
},
async fetchMetricIndex() {
if (this.instance.hasEndpoint('metrics')) {
......
......@@ -67,7 +67,7 @@
import sbaEnvManager from './env-manager';
const filterProperty = (needle) => (property, name) => {
return name.toString().toLowerCase().indexOf(needle) >= 0 || property.value.toString().toLowerCase().indexOf(needle) >= 0;
return name.toString().toLowerCase().includes(needle) || property.value.toString().toLowerCase().includes(needle);
};
const filterProperties = (needle, properties) => _.pickBy(properties, filterProperty(needle));
const filterPropertySource = (needle) => (propertySource) => {
......
......@@ -161,7 +161,7 @@
}),
computed: {
actuatorPath() {
if (this.instance.registration.managementUrl.indexOf(this.instance.registration.serviceUrl) >= 0) {
if (this.instance.registration.managementUrl.includes(this.instance.registration.serviceUrl)) {
const appendix = this.instance.registration.managementUrl.substring(this.instance.registration.serviceUrl.length);
if (appendix.length > 0) {
return `/${appendix}`;
......@@ -214,11 +214,11 @@
getFilterFn() {
let filterFn = null;
if (this.actuatorPath !== null && this.excludeActuator) {
filterFn = addToFilter(filterFn, (trace) => trace.request.uri.indexOf(this.actuatorPath) < 0);
filterFn = addToFilter(filterFn, (trace) => !trace.request.uri.includes(this.actuatorPath));
}
if (this.filter) {
const normalizedFilter = this.filter.toLowerCase();
filterFn = addToFilter(filterFn, (trace) => trace.request.uri.toLowerCase().indexOf(normalizedFilter) >= 0);
filterFn = addToFilter(filterFn, (trace) => trace.request.uri.toLowerCase().includes(normalizedFilter));
}
if (!this.showSuccess) {
filterFn = addToFilter(filterFn, (trace) => !trace.isSuccess());
......
......@@ -185,7 +185,7 @@
if (this.filter) {
const normalizedFilter = this.filter.toLowerCase();
filterFn = addToFilter(filterFn, logger => logger.name.toLowerCase().indexOf(normalizedFilter) >= 0);
filterFn = addToFilter(filterFn, logger => logger.name.toLowerCase().includes(normalizedFilter));
}
return filterFn;
......
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