@cobuildlab/8base-chat
Version:
Chat component that uses 8base
19 lines (15 loc) • 453 B
text/typescript
export function getExtension(filename: any) {
if (typeof filename !== 'string') {
return '';
}
const match = filename.match(/^.+\.(\w+)$/);
return match ? match[1] : '';
}
export function isImage(extension: string) {
return /^(gif|jpe?g|png|svg|tiff|webp)$/.test(extension);
}
export function isPreviewSupported(extension: string) {
return /^(gif|jpe?g|png|tiff|pdf|pptx?|xlsx?|odt|odf|html?|txt|ai|psd)$/.test(
extension,
);
}