fix: fixed linting issues

pull/1097/head
smit95tpatel 2022-05-13 11:42:15 +05:30
parent 1f1b823f60
commit 9871164539
1 changed files with 19 additions and 27 deletions

View File

@ -1,15 +1,15 @@
// import DateUtils from "./DateUtils";
export function findStatus(data) {
if (!Array.isArray(data)) return null;
if (data.length === 0) return null;
const uptime = data.every((d) => d.online === true);
const degraded = data.some((d) => d.online === false);
const downtime = data.every((d) => d.online === false);
if (uptime) return 'uptime';
if (downtime) return 'downtime';
if (degraded) return 'degraded';
return '';
if (!Array.isArray(data)) return null;
if (data.length === 0) return null;
const uptime = data.every((d) => d.online === true);
const degraded = data.some((d) => d.online === false);
const downtime = data.every((d) => d.online === false);
if (uptime) return "uptime";
if (downtime) return "downtime";
if (degraded) return "degraded";
return "";
}
// export function inRange(message) {
@ -23,23 +23,23 @@ export function findStatus(data) {
// }
export const isObject = (obj) => {
if (Object.prototype.toString.call(obj) === '[object Object]') {
return true;
}
if (Object.prototype.toString.call(obj) === "[object Object]") {
return true;
}
return false;
return false;
};
export const isObjectEmpty = (obj) => {
if (Object.keys(obj).length === 0) {
return true;
}
return false;
if (Object.keys(obj).length === 0) {
return true;
}
return false;
};
export const calcPer = (uptime, downtime) => {
const percentage = ((uptime / (uptime + downtime)) * 100).toFixed(2);
return percentage;
const percentage = ((uptime / (uptime + downtime)) * 100).toFixed(2);
return percentage;
};
// export function formatString(arr) {
@ -58,14 +58,6 @@ export const calcPer = (uptime, downtime) => {
// return arrayStr.join("<br/>");
// }
/* Delimiters are space / underscore */
export function titleCase(sentence) {
return (sentence || '')
.split(/\s+|_/)
.map((word) => word.charAt(0).toUpperCase() + word.substr(1).toLowerCase())
.join(' ');
}
export const setUerId = (id) => {
localStorage.setItem('stat_user_id',id);
}