From 98711645397530d65bd66371444018efc212ee7a Mon Sep 17 00:00:00 2001 From: smit95tpatel Date: Fri, 13 May 2022 11:42:15 +0530 Subject: [PATCH] fix: fixed linting issues --- react-frontend/src/utils/helper.js | 46 ++++++++++++------------------ 1 file changed, 19 insertions(+), 27 deletions(-) diff --git a/react-frontend/src/utils/helper.js b/react-frontend/src/utils/helper.js index 7c547cfc..be1f8f37 100644 --- a/react-frontend/src/utils/helper.js +++ b/react-frontend/src/utils/helper.js @@ -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("
"); // } -/* 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); }