Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/cache/helpers.ts

🥌 Deno cache library
Very Popular
Latest
File
import { fromFileUrl, resolve, toFileUrl } from "./deps.ts";
export function toURL(url: string | URL): URL { if (typeof url === "string") { if ( url.startsWith("http:") || url.startsWith("https:") || url.startsWith("file:") ) { url = new URL(url); } else { url = toFileUrl(resolve(url)); } } else if (url.protocol === "file:") { url = toFileUrl(resolve(fromFileUrl(url))); }
return url;}