mirror of https://github.com/statping/statping
fix: fixed linting issues
parent
1f1b823f60
commit
9871164539
|
@ -1,15 +1,15 @@
|
||||||
// import DateUtils from "./DateUtils";
|
// import DateUtils from "./DateUtils";
|
||||||
|
|
||||||
export function findStatus(data) {
|
export function findStatus(data) {
|
||||||
if (!Array.isArray(data)) return null;
|
if (!Array.isArray(data)) return null;
|
||||||
if (data.length === 0) return null;
|
if (data.length === 0) return null;
|
||||||
const uptime = data.every((d) => d.online === true);
|
const uptime = data.every((d) => d.online === true);
|
||||||
const degraded = data.some((d) => d.online === false);
|
const degraded = data.some((d) => d.online === false);
|
||||||
const downtime = data.every((d) => d.online === false);
|
const downtime = data.every((d) => d.online === false);
|
||||||
if (uptime) return 'uptime';
|
if (uptime) return "uptime";
|
||||||
if (downtime) return 'downtime';
|
if (downtime) return "downtime";
|
||||||
if (degraded) return 'degraded';
|
if (degraded) return "degraded";
|
||||||
return '';
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
// export function inRange(message) {
|
// export function inRange(message) {
|
||||||
|
@ -23,23 +23,23 @@ export function findStatus(data) {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
export const isObject = (obj) => {
|
export const isObject = (obj) => {
|
||||||
if (Object.prototype.toString.call(obj) === '[object Object]') {
|
if (Object.prototype.toString.call(obj) === "[object Object]") {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const isObjectEmpty = (obj) => {
|
export const isObjectEmpty = (obj) => {
|
||||||
if (Object.keys(obj).length === 0) {
|
if (Object.keys(obj).length === 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const calcPer = (uptime, downtime) => {
|
export const calcPer = (uptime, downtime) => {
|
||||||
const percentage = ((uptime / (uptime + downtime)) * 100).toFixed(2);
|
const percentage = ((uptime / (uptime + downtime)) * 100).toFixed(2);
|
||||||
return percentage;
|
return percentage;
|
||||||
};
|
};
|
||||||
|
|
||||||
// export function formatString(arr) {
|
// export function formatString(arr) {
|
||||||
|
@ -58,14 +58,6 @@ export const calcPer = (uptime, downtime) => {
|
||||||
// return arrayStr.join("<br/>");
|
// 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) => {
|
export const setUerId = (id) => {
|
||||||
localStorage.setItem('stat_user_id',id);
|
localStorage.setItem('stat_user_id',id);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue