* @param {string} service * @param {URL} url * @param {{}} config * @param {{}} options * @param {string} frontend
(service, url, config, options, frontend)
| 35 | * @param {string} frontend |
| 36 | */ |
| 37 | function regexArray(service, url, config, options, frontend) { |
| 38 | let targetList = config.services[service].targets |
| 39 | if (frontend) { |
| 40 | if ( |
| 41 | "excludeTargets" in config.services[service].frontends[frontend] && |
| 42 | (service !== "search" || !options["search"].redirectGoogle) |
| 43 | ) { |
| 44 | targetList = targetList.filter( |
| 45 | val => !config.services[service].frontends[frontend].excludeTargets.includes(targetList.indexOf(val)) |
| 46 | ) |
| 47 | } |
| 48 | if (service === "twitter" && options["twitter"].disableTwimg) { |
| 49 | targetList.splice(2, 1) |
| 50 | } |
| 51 | } |
| 52 | for (const targetString in targetList) { |
| 53 | const target = new RegExp(targetList[targetString]) |
| 54 | if (target.test(url.href)) return true |
| 55 | } |
| 56 | return false |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * @param {URL} url |
no outgoing calls
no test coverage detected