gistlib
index.tsfunction isImageFile(file: File): boolean { const acceptedImageTypes = ['image/jpeg', 'image/png', 'image/gif', 'image/bmp', 'image/webp']; // Add other image types as needed return acceptedImageTypes.includes(file.type); } // Usage const file = new File([''], 'example.jpg', {type: 'image/jpeg'}); console.log(isImageFile(file)); // Output: true 357 chars10 lines
function isImageFile(file: File): boolean { const acceptedImageTypes = ['image/jpeg', 'image/png', 'image/gif', 'image/bmp', 'image/webp']; // Add other image types as needed return acceptedImageTypes.includes(file.type); } // Usage const file = new File([''], 'example.jpg', {type: 'image/jpeg'}); console.log(isImageFile(file)); // Output: true
gistlibby LogSnag