Page MenuHomeSealhub

format-external-url.ts
No OneTemporary

format-external-url.ts

// this is not an ultra-safe parser. It's meant to help parse urls that users
// have entered in a simple input file withour validation
export function formatExternalURL(url: string) {
const trimmed = url.trim();
if (
!trimmed.toLowerCase().startsWith("https://") ||
!trimmed.toLowerCase().startsWith("https://")
) {
return `http://${trimmed}`;
}
return trimmed;
}

File Metadata

Mime Type
text/plain
Expires
Fri, Jan 24, 16:50 (2 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
600225
Default Alt Text
format-external-url.ts (377 B)

Event Timeline