File size: 289 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
export const isValidHttpUrl = (string: string) => {
let url
try {
url = new URL(string)
} catch (_) {
return false
}
return url.protocol === 'http:' || url.protocol === 'https:'
}
export const capitalize = (str: string) =>
str.charAt(0).toUpperCase() + str.slice(1)
|