UNPKG

@opra/common

Version:
13 lines (12 loc) 386 B
export function testScopeMatch(scope, pattern) { if (!pattern || scope === '*') return true; if (!scope) return false; if (Array.isArray(pattern)) { return pattern.some(x => { return typeof x === 'string' ? scope === x : x.test(scope); }); } return typeof pattern === 'string' ? scope === pattern : pattern.test(scope); }