feat: add modelTypes
This commit is contained in:
parent
8416b1f448
commit
7d4ba6249e
91 changed files with 751 additions and 513 deletions
|
|
@ -1,4 +1,4 @@
|
|||
export function colorIsDark(color) {
|
||||
export function colorIsDark(color: string | undefined) {
|
||||
if (typeof color === 'undefined') {
|
||||
return true // Defaults to dark
|
||||
}
|
||||
|
|
|
|||
18
src/helpers/getHumanSize.ts
Normal file
18
src/helpers/getHumanSize.ts
Normal 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]
|
||||
}
|
||||
Reference in a new issue