Files

13 lines
433 B
JavaScript
Raw Permalink Normal View History

2026-05-03 12:12:57 -04:00
export default function(path, domains = []) {
// filter out non-strings
domains = domains.filter(domain => typeof domain === 'string');
// separate out strings and regex
const regexers = domains.map(domain => new RegExp(domain)) ?? [];
return false
|| domains.find(domain => path.startsWith(domain)) !== undefined
|| regexers.map(regexer => regexer.test(path)).find(matched => matched === true) !== undefined;
}