1
0

feat: add modelTypes

This commit is contained in:
Dominik Pschenitschni
2022-08-04 20:57:43 +02:00
parent 8416b1f448
commit 7d4ba6249e
91 changed files with 751 additions and 513 deletions

View File

@ -1,4 +1,4 @@
export function colorIsDark(color) {
export function colorIsDark(color: string | undefined) {
if (typeof color === 'undefined') {
return true // Defaults to dark
}

View File

@ -0,0 +1,18 @@
const SIZES = [
'B',
'KB',
'MB',
'GB',
'TB',
] as const
export function getHumanSize(inputSize: number) {
let iterator = 0
let size = inputSize
while (size > 1024) {
size /= 1024
iterator++
}
return Number(Math.round(Number(size + 'e2')) + 'e-2') + ' ' + SIZES[iterator]
}