mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-15 23:47:33 +08:00
migrate importing transaction dialog to composition API and typescript
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import type { ImportFileTypeAndExtensions } from '@/core/file.ts';
|
||||
|
||||
import { isString } from './common.ts';
|
||||
|
||||
export function getFileExtension(filename: string): string {
|
||||
@@ -9,6 +11,20 @@ export function getFileExtension(filename: string): string {
|
||||
return parts[parts.length - 1];
|
||||
}
|
||||
|
||||
export function findExtensionByType(items: ImportFileTypeAndExtensions[] | undefined, type: string): string | undefined {
|
||||
if (!items || items.length < 1) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
for (const item of items) {
|
||||
if (item.type === type) {
|
||||
return item.extensions;
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function isFileExtensionSupported(filename: string, supportedExtensions: string): boolean {
|
||||
if (!supportedExtensions) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user