Add Attachment.isVisualMedia

This commit is contained in:
Daniel Gasienica 2018-04-09 19:29:38 -04:00
parent 47cc701e72
commit fc12353bb8

View file

@ -1,3 +1,6 @@
import is from '@sindresorhus/is';
import * as GoogleChrome from '../GoogleChrome';
import { MIMEType } from './MIME';
@ -16,4 +19,16 @@ export interface Attachment {
// key?: ArrayBuffer;
// digest?: ArrayBuffer;
// flags?: number;
}
};
export const isVisualMedia = (attachment: Attachment): boolean => {
const { contentType } = attachment;
if (is.undefined(contentType)) {
return false;
}
const isSupportedImageType = GoogleChrome.isImageTypeSupported(contentType);
const isSupportedVideoType = GoogleChrome.isVideoTypeSupported(contentType);
return isSupportedImageType || isSupportedVideoType;
};