986777b73d
* Remove image and animation_url from metadata modal * Use animation_url for storing audio and video asset URIs * Use image and animation_url keys together for audio/video assets * Delete empty metadata keys * Post-review update
12 lines
560 B
TypeScript
12 lines
560 B
TypeScript
/* eslint-disable eslint-comments/disable-enable-pair */
|
|
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
|
export type AssetType = 'image' | 'audio' | 'video' | 'unknown'
|
|
|
|
export const getAssetType = (assetFileName: string): AssetType => {
|
|
const assetType = assetFileName?.split('.').pop() || 'unknown'
|
|
if (assetType === 'png' || assetType === 'jpg' || assetType === 'jpeg' || assetType === 'svg') return 'image'
|
|
if (assetType === 'mp3' || assetType === 'wav') return 'audio'
|
|
if (assetType === 'mp4') return 'video'
|
|
return 'unknown'
|
|
}
|