mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-10-17 05:11:57 +08:00
08a38f0a5e
* refactor: typing house-keeping * fix: fix parse date not accepting strict mode * refactor: use npm package * fix: address review
12 lines
287 B
TypeScript
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 };
|