UNPKG

sanity

Version:

Sanity is a real-time content infrastructure with a scalable, hosted backend featuring a Graph Oriented Query Language (GROQ), asset pipelines and fast edge caches

20 lines (17 loc) 571 B
import {type SchemaType} from '@sanity/types' import {type FIXME} from '../../../FIXME' import * as is from '../../utils/is' import {accepts} from './accepts' import {type FileLike, type Uploader} from './types' import {uploaders} from './uploaders' export function resolveUploader(type: SchemaType, file: FileLike): Uploader | null { return ( uploaders.find((uploader) => { return ( is.type(uploader.type, type) && accepts(file, uploader.accepts) && accepts(file, (type.options as FIXME)?.accept || '') ) }) || null ) }