@technobuddha > library > RegExp > Validation
Function: isDomain()
ts
function isDomain(text: string): boolean;Defined in: is-domain.ts:17
Determines whether the given string is a valid domain name.
Parameters
| Parameter | Type | Description |
|---|---|---|
text | string | The string to test as a domain name. |
Returns
boolean
true if the string is a valid domain name, otherwise false.
Example
typescript
isDomain("example.com"); // true
isDomain("not a domain"); // false