You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			37 lines
		
	
	
		
			878 B
		
	
	
	
		
			TypeScript
		
	
			
		
		
	
	
			37 lines
		
	
	
		
			878 B
		
	
	
	
		
			TypeScript
		
	
| /**
 | |
|  * @prettier
 | |
|  */
 | |
| import is from '@sindresorhus/is';
 | |
| 
 | |
| import * as GoogleChrome from '../util/GoogleChrome';
 | |
| import { MIMEType } from './MIME';
 | |
| 
 | |
| export interface Attachment {
 | |
|   fileName?: string;
 | |
|   contentType?: MIMEType;
 | |
|   size?: number;
 | |
|   data: ArrayBuffer;
 | |
| 
 | |
|   // // Omit unused / deprecated keys:
 | |
|   // schemaVersion?: number;
 | |
|   // id?: string;
 | |
|   // width?: number;
 | |
|   // height?: number;
 | |
|   // thumbnail?: ArrayBuffer;
 | |
|   // 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;
 | |
| };
 |