UNPKG

@prismicio/types-internal

Version:
23 lines (21 loc) 632 B
// This type represents response format from oEmbed API export type Embed = { type: string version?: string | null author_name?: string | null author_url?: string | null provider_name?: string | null provider_url?: string | null cache_age?: string | null thumbnail_url?: string | null thumbnail_width?: number | null thumbnail_height?: number | null html?: string | null title?: string | null } export const getEmbedOrThrow = (embeds: Record<string, Embed | undefined>) => (embedUrl: string) => { const embed = embeds[embedUrl] if (!embed) throw new Error(`Missing embed with url '${embedUrl}'`) return embed }