🚧 Working on CPU Usage Widgets
This commit is contained in:
@@ -86,7 +86,8 @@ export const showNumAsThousand = (bigNum) => {
|
||||
|
||||
/* Capitalizes the first letter of each word within a string */
|
||||
export const capitalize = (str) => {
|
||||
return str.replace(/\w\S*/g, (w) => (w.replace(/^\w/, (c) => c.toUpperCase())));
|
||||
const words = str.replaceAll('_', ' ').replaceAll('-', ' ');
|
||||
return words.replace(/\w\S*/g, (w) => (w.replace(/^\w/, (c) => c.toUpperCase())));
|
||||
};
|
||||
|
||||
/* Round price to appropriate number of decimals */
|
||||
@@ -122,6 +123,12 @@ export const getTimeAgo = (dateTime) => {
|
||||
return 'unknown';
|
||||
};
|
||||
|
||||
/* Given the name of a CSS variable, returns it's value */
|
||||
export const getValueFromCss = (colorVar) => {
|
||||
const cssProps = getComputedStyle(document.documentElement);
|
||||
return cssProps.getPropertyValue(`--${colorVar}`).trim();
|
||||
};
|
||||
|
||||
/* Given a currency code, return the corresponding unicode symbol */
|
||||
export const findCurrencySymbol = (currencyCode) => {
|
||||
const code = currencyCode.toUpperCase().trim();
|
||||
|
||||
Reference in New Issue
Block a user