UNPKG

@toantranmei/mei-nuxt3-fetcher

Version:
13 lines (12 loc) 327 B
import { parseURL } from "ufo"; export function getOriginAndPathnameFromURL(url) { const { protocol, host, pathname } = parseURL(url); let origin; if (host && protocol) origin = `${protocol}//${host}`; const pathname_ = pathname.length > 0 ? pathname : void 0; return { origin, pathname: pathname_ }; }