(url, thispages)
| 1 | export function getPageConfig(url, thispages) { |
| 2 | for (const key in thispages) { |
| 3 | const page = thispages[key]; |
| 4 | if (j.$.isArray(page.domain)) { |
| 5 | let resPage; |
| 6 | page.domain.forEach(singleDomain => { |
| 7 | if (checkDomain(url, singleDomain)) { |
| 8 | page.domain = singleDomain; |
| 9 | resPage = page; |
| 10 | } |
| 11 | }); |
| 12 | if (resPage) return resPage; |
| 13 | } else if (checkDomain(url, page.domain)) { |
| 14 | return page; |
| 15 | } |
| 16 | } |
| 17 | return null; |
| 18 | } |
| 19 | |
| 20 | function checkDomain(url, domain) { |
| 21 | const partDomain = utils.urlPart(domain, 2).replace('.com.br', '.br').split('.').slice(-2, -1)[0]; |
no test coverage detected