Add Attachment.isVisualMedia
This commit is contained in:
parent
47cc701e72
commit
fc12353bb8
1 changed files with 16 additions and 1 deletions
|
@ -1,3 +1,6 @@
|
||||||
|
import is from '@sindresorhus/is';
|
||||||
|
|
||||||
|
import * as GoogleChrome from '../GoogleChrome';
|
||||||
import { MIMEType } from './MIME';
|
import { MIMEType } from './MIME';
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,4 +19,16 @@ export interface Attachment {
|
||||||
// key?: ArrayBuffer;
|
// key?: ArrayBuffer;
|
||||||
// digest?: ArrayBuffer;
|
// digest?: ArrayBuffer;
|
||||||
// flags?: number;
|
// 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;
|
||||||
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue