build status: failing
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
export function formatBytes(bytes: number) {
|
||||
// format bytes in to a readable format like (MB, GB, etc), depending on how big the number is
|
||||
if (bytes < 1024) {
|
||||
return `${bytes} B`
|
||||
}
|
||||
|
||||
if (bytes < 1024 * 1024) {
|
||||
return `${(bytes / 1024).toFixed(2)} KB`
|
||||
}
|
||||
|
||||
if (bytes < 1024 * 1024 * 1024) {
|
||||
return `${(bytes / 1024 / 1024).toFixed(2)} MB`
|
||||
}
|
||||
|
||||
return `${(bytes / 1024 / 1024 / 1024).toFixed(2)} GB`
|
||||
}
|
||||
|
||||
export function replaceSmartQuotes(value: string) {
|
||||
const replacements: { [key: string]: string } = {
|
||||
'‘': "'",
|
||||
'’': "'",
|
||||
'‚': "'",
|
||||
'“': '"',
|
||||
'”': '"',
|
||||
'„': '"',
|
||||
}
|
||||
return value.replace(/[‘’‚“”„]/g, (match) => replacements[match])
|
||||
}
|
||||
Reference in New Issue
Block a user