初始化模版工程

This commit is contained in:
Cloud Bot
2026-03-20 07:33:46 +00:00
commit 23717e0ecd
386 changed files with 51675 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
/**
* 获取文件扩展名
*/
function getFileExtension(path: string): string {
const parts = path.split('.')
return parts.length > 1 ? parts[parts.length - 1].toLowerCase() : ''
}
/**
* 判断是否是图片文件
*/
export function isImageFile(path: string): boolean {
const ext = getFileExtension(path.replace(/\?.*$/, ''))
return ['jpg', 'jpeg', 'png', 'gif', 'webp', 'svg', 'bmp'].includes(ext)
}
export function safeParse(val: string) {
try {
return JSON.parse(val)
} catch {
return {}
}
}