MCPcopy Index your code
hub / github.com/MALSync/MALSync / getPageConfig

Function getPageConfig

src/utils/test.ts:1–18  ·  view source on GitHub ↗
(url, thispages)

Source from the content-addressed store, hash-verified

1export 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
20function checkDomain(url, domain) {
21 const partDomain = utils.urlPart(domain, 2).replace('.com.br', '.br').split('.').slice(-2, -1)[0];

Callers 2

index.tsFile · 0.90
getPageMethod · 0.90

Calls 1

checkDomainFunction · 0.85

Tested by

no test coverage detected