Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 50x 50x 185x 175x 10x | export function safelyAppendUrlParameter (url: string, parameterKey: string, parameterValue: string): string {
const separator = url.includes('?') ? '&' : '?';
return `${url}${separator}${parameterKey}=${parameterValue}`;
}
export function isValidUrl (url: string): boolean {
try {
const parsedUrl = new URL(url);
return !parsedUrl.pathname.includes(' ') && !parsedUrl.hostname.includes(' ') && url.includes(':');
} catch {
return false;
}
}
|