From 85fc484ab0f7ca42aa756ecc99293c782d76ee78 Mon Sep 17 00:00:00 2001 From: huaiyuan <1029848564@qq.com> Date: Thu, 29 Aug 2024 19:36:12 +0800 Subject: [PATCH] fix: update files --- package.json | 2 +- src/files.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 9abb001..7b245b9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bytetrade/core", - "version": "0.3.60", + "version": "0.3.61", "description": "didvault core module", "main": "./dist/index.js", "types": "./dist/index.d.ts", diff --git a/src/files.ts b/src/files.ts index 404dd3e..0bdcf7a 100644 --- a/src/files.ts +++ b/src/files.ts @@ -1,12 +1,12 @@ -export function getFileIcon(fileName: string) { +export function getFileIcon(fileName: string): string { let suffix = ''; let result: string | undefined = ''; if (fileName) { const fileArr = fileName.split('.'); suffix = fileArr[fileArr.length - 1]; } - if (!suffix) return false; + if (!suffix) return 'other'; suffix = suffix.toLocaleLowerCase(); const imgList = ['png', 'jpg', 'jpeg', 'bmp', 'gif']; @@ -58,14 +58,14 @@ export function getFileIcon(fileName: string) { return 'other'; } -export function getFileType(fileName: string) { +export function getFileType(fileName: string): string { let suffix = ''; let result: string | undefined = ''; if (fileName) { const fileArr = fileName.split('.'); suffix = fileArr[fileArr.length - 1]; } - if (!suffix) return false; + if (!suffix) return 'blob'; suffix = suffix.toLocaleLowerCase(); const docList = ['doc'];