getFileExtension = (fileName) => {
return fileName.substring(fileName.lastIndexOf('.') + 1)
}
const isExcel = (fileName) => {
const fileExt = getFileExtension(fileName)
return ['xlsx', 'xls'].includes(fileExt)
}
const isJsonFile = (fileName) => {
const fileExt = getFileExtension(fileName)
return ['json'].includes(fileExt)
}
标签:const,后缀,getFileExtension,前端,fileName,fileExt,获取,return,includes
From: https://www.cnblogs.com/luckyitape/p/17138196.html