UNPKG

astro

Version:

Astro is a modern site builder with web best practices, performance, and DX front-of-mind.

23 lines (22 loc) 507 B
import { extname } from "node:path"; import { isFontType } from "../utils.js"; function createFontTypeExtractor({ errorHandler }) { return { extract(url) { const extension = extname(url).slice(1); if (!isFontType(extension)) { throw errorHandler.handle({ type: "cannot-extract-font-type", data: { url }, cause: `Unexpected extension, got "${extension}"` }); } return extension; } }; } export { createFontTypeExtractor };