@stacksjs/ts-validation
Version:
A simple TypeScript starter kit using Bun.
11 lines (10 loc) • 334 B
TypeScript
declare function isRegExp(obj: any): boolean;
export default function checkHost(host: string, matches: (string | RegExp)[]): boolean {
for (let i = 0; i < matches.length; i++) {
const match = matches[i]
if (host === match || (isRegExp(match) && (match as RegExp).test(host))) {
return true
}
}
return false
};