(property: PropertyDefinition, normalizedDomain: string)
| 472 | } |
| 473 | |
| 474 | private propertyMatchesDomain(property: PropertyDefinition, normalizedDomain: string): boolean { |
| 475 | if (property.publisher_domain && this.normalizeDomain(property.publisher_domain) === normalizedDomain) { |
| 476 | return true; |
| 477 | } |
| 478 | |
| 479 | return (property.identifiers || []).some((identifier) => { |
| 480 | if (identifier.type !== "domain") { |
| 481 | return false; |
| 482 | } |
| 483 | |
| 484 | const identifierValue = this.normalizeDomain(identifier.value); |
| 485 | if (identifierValue.startsWith("*.")) { |
| 486 | const baseDomain = identifierValue.slice(2); |
| 487 | return normalizedDomain.endsWith(`.${baseDomain}`) && normalizedDomain !== baseDomain; |
| 488 | } |
| 489 | |
| 490 | if (identifierValue === normalizedDomain) { |
| 491 | return true; |
| 492 | } |
| 493 | |
| 494 | return !identifierValue.includes(".") ? |
| 495 | false : |
| 496 | this.matchesBaseDomain(identifierValue, normalizedDomain); |
| 497 | }); |
| 498 | } |
| 499 | |
| 500 | private matchesBaseDomain(identifierValue: string, normalizedDomain: string): boolean { |
| 501 | if (identifierValue === normalizedDomain) { |
no test coverage detected