🐛 web缺失函数

This commit is contained in:
Martial BE
2023-12-22 11:16:48 +08:00
parent 5a8fef00e5
commit 89e6b9fe33
2 changed files with 10 additions and 1 deletions

View File

@@ -140,6 +140,15 @@ export function renderQuota(quota, digits = 2) {
return renderNumber(quota);
}
export const verifyJSON = (str) => {
try {
JSON.parse(str);
} catch (e) {
return false;
}
return true;
};
export function renderNumber(num) {
if (num >= 1000000000) {
return (num / 1000000000).toFixed(1) + 'B';