Skip to main content

sanitiseDnsString(dnsString): string

Defined in: src/dns/utils/dns-string-sanitiser.ts:16

Sanitises a DNS string by trimming whitespace, removing internal spaces, and converting to lowercase.

This function ensures that the input string is properly formatted for use in DNS contexts by removing any extraneous whitespace and normalizing the case.

Parameters

dnsString

string

The DNS string to sanitise

Returns

string

The sanitised DNS string with whitespace removed and converted to lowercase

Example

sanitiseDnsString('  My Domain Name  ') // Returns 'mydomainname'
sanitiseDnsString('API Gateway') // Returns 'apigateway'