lib/uri_parser.js
function matchesParentDomain(srvAddress, parentDomain) {
  const regex = /^.*?\./;
  const srv = `.${srvAddress.replace(regex, '')}`;
  const parent = `.${parentDomain.replace(regex, '')}`;
  return srv.endsWith(parent);
}
function matchesParentDomain(srvAddress, parentDomain) {
  const regex = /^.*?\./;
  const srv = `.${srvAddress.replace(regex, '')}`;
  const parent = `.${parentDomain.replace(regex, '')}`;
  return srv.endsWith(parent);
}
function matchesParentDomain ( srvAddress , parentDomain ) { const regex = / ^.*?\. / ; const srv = ` ${ srvAddress . replace ( regex , '' ) } ` ; const parent = ` ${ parentDomain . replace ( regex , '' ) } ` ; return srv . endsWith ( parent ) ; }
Determines whether a provided address matches the provided parent domain in order
to avoid certain attack vectors.

@param {String} srvAddress The address to check against a domain
@param {String} parentDomain The domain to check the provided address against
@return {Boolean} Whether the provided address matches the parent domain
Determines whether a provided address matches the provided parent domain in order to avoid certain attack vectors .