Files
Tony 08a38f0a5e refactor: typing house-keeping (#23074)
* refactor: typing house-keeping

* fix: fix parse date not accepting strict mode

* refactor: use npm package

* fix: address review
2026-08-22 23:58:30 +08:00

12 lines
287 B
TypeScript

/**
* Check if a sub-domain is valid
* @param {String} hostname sub-domain
* @returns {Boolean} true if valid
*/
const isValidHost = (hostname?: string) => {
const regex = /^[\dA-Z](?:[\dA-Z-]{0,61}[\dA-Z])?$/i;
return regex.test(hostname ?? '');
};
export { isValidHost };