UNPKG

rsshub

Version:
13 lines (12 loc) 346 B
//#region lib/utils/valid-host.ts /** * Check if a sub-domain is valid * @param {String} hostname sub-domain * @returns {Boolean} true if valid */ const isValidHost = (hostname) => { if (typeof hostname !== "string") return false; return /^[\dA-Za-z]([\dA-Za-z-]{0,61}[\dA-Za-z])?$/.test(hostname); }; //#endregion export { isValidHost as t };