mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-19 01:35:18 -04:00
Migrate utils.js to TypeScript
Signed-off-by: David Mehren <dmehren1@gmail.com>
This commit is contained in:
parent
e87c8f04e5
commit
03ae37055d
2 changed files with 30 additions and 27 deletions
30
lib/utils.ts
Normal file
30
lib/utils.ts
Normal file
|
@ -0,0 +1,30 @@
|
|||
export module Utils {
|
||||
export function isSQLite(sequelize) {
|
||||
return sequelize.options.dialect === 'sqlite'
|
||||
}
|
||||
|
||||
export function getImageMimeType(imagePath: string) {
|
||||
const fileExtension = /[^.]+$/.exec(imagePath)
|
||||
switch (fileExtension?.[0]) {
|
||||
case 'bmp':
|
||||
return 'image/bmp'
|
||||
case 'gif':
|
||||
return 'image/gif'
|
||||
case 'jpg':
|
||||
case 'jpeg':
|
||||
return 'image/jpeg'
|
||||
case 'png':
|
||||
return 'image/png'
|
||||
case 'tiff':
|
||||
return 'image/tiff'
|
||||
case 'svg':
|
||||
return 'image/svg+xml'
|
||||
default:
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue