UNPKG

typia

Version:

Superfast runtime validators with only one line

5 lines (3 loc) 202 B
export const _isFormatHostname = (str: string): boolean => PATTERN.test(str); const PATTERN = /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i;