260e9a18d0
* Re-engineer UI in TypeScript * Switch to named imports where possible * Restructure file system layout * Update depencencies * Update README.md * Change explicit colors for better support for dark theme
7 lines
319 B
TypeScript
7 lines
319 B
TypeScript
const hostnameLengthRegex = /^.{0,32}$/
|
|
const hostnamePatternRegex = /^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9])$/
|
|
|
|
export default function isHostname(hostname: string) {
|
|
return hostnameLengthRegex.test(hostname) && hostnamePatternRegex.test(hostname);
|
|
}
|