(subject: string)
| 114 | |
| 115 | /** Throws an error if the URL is not valid */ |
| 116 | export function tryValidURL(subject: string): void { |
| 117 | try { |
| 118 | new URL(subject); |
| 119 | } catch (e) { |
| 120 | throw new Error(`Not a valid URL: ${subject}. ${e}`); |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | /** Returns true if a URL is valid. */ |
| 125 | export function isValidURL(subject: string): boolean { |
no outgoing calls
no test coverage detected