UNPKG

@opra/common

Version:
16 lines (15 loc) 497 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.testScopeMatch = testScopeMatch; 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); }