tldts 5.7.80 → 5.7.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -416,7 +416,7 @@ function resetResult(result) {
416
416
  result.subdomain = null;
417
417
  }
418
418
  function parseImpl(url, step, suffixLookup, partialOptions, result) {
419
- const options = setDefaults(partialOptions);
419
+ const options = /*@__INLINE__*/ setDefaults(partialOptions);
420
420
  // Very fast approximate check to make sure `url` is a string. This is needed
421
421
  // because the library will not necessarily be used in a typed setup and
422
422
  // values of arbitrary types might be given as argument.
@@ -442,7 +442,7 @@ function parseImpl(url, step, suffixLookup, partialOptions, result) {
442
442
  else {
443
443
  result.hostname = extractHostname(url, false);
444
444
  }
445
- if (step === 0 /* HOSTNAME */ || result.hostname === null) {
445
+ if (step === 0 /* FLAG.HOSTNAME */ || result.hostname === null) {
446
446
  return result;
447
447
  }
448
448
  // Check if `hostname` is a valid ip address
@@ -462,17 +462,17 @@ function parseImpl(url, step, suffixLookup, partialOptions, result) {
462
462
  }
463
463
  // Extract public suffix
464
464
  suffixLookup(result.hostname, options, result);
465
- if (step === 2 /* PUBLIC_SUFFIX */ || result.publicSuffix === null) {
465
+ if (step === 2 /* FLAG.PUBLIC_SUFFIX */ || result.publicSuffix === null) {
466
466
  return result;
467
467
  }
468
468
  // Extract domain
469
469
  result.domain = getDomain$1(result.publicSuffix, result.hostname, options);
470
- if (step === 3 /* DOMAIN */ || result.domain === null) {
470
+ if (step === 3 /* FLAG.DOMAIN */ || result.domain === null) {
471
471
  return result;
472
472
  }
473
473
  // Extract subdomain
474
474
  result.subdomain = getSubdomain$1(result.hostname, result.domain);
475
- if (step === 4 /* SUB_DOMAIN */) {
475
+ if (step === 4 /* FLAG.SUB_DOMAIN */) {
476
476
  return result;
477
477
  }
478
478
  // Extract domain without suffix
@@ -568,8 +568,8 @@ function lookupInTrie(parts, trie, index, allowedMask) {
568
568
  if ((node.$ & allowedMask) !== 0) {
569
569
  result = {
570
570
  index: index + 1,
571
- isIcann: node.$ === 1 /* ICANN */,
572
- isPrivate: node.$ === 2 /* PRIVATE */,
571
+ isIcann: node.$ === 1 /* RULE_TYPE.ICANN */,
572
+ isPrivate: node.$ === 2 /* RULE_TYPE.PRIVATE */,
573
573
  };
574
574
  }
575
575
  // No more `parts` to look for
@@ -590,8 +590,8 @@ function suffixLookup(hostname, options, out) {
590
590
  return;
591
591
  }
592
592
  const hostnameParts = hostname.split('.');
593
- const allowedMask = (options.allowPrivateDomains === true ? 2 /* PRIVATE */ : 0) |
594
- (options.allowIcannDomains === true ? 1 /* ICANN */ : 0);
593
+ const allowedMask = (options.allowPrivateDomains === true ? 2 /* RULE_TYPE.PRIVATE */ : 0) |
594
+ (options.allowIcannDomains === true ? 1 /* RULE_TYPE.ICANN */ : 0);
595
595
  // Look for exceptions
596
596
  const exceptionMatch = lookupInTrie(hostnameParts, exceptions, hostnameParts.length - 1, allowedMask);
597
597
  if (exceptionMatch !== null) {
@@ -621,29 +621,29 @@ function suffixLookup(hostname, options, out) {
621
621
  // this un-necessary allocation, we use a global object which is re-used.
622
622
  const RESULT = getEmptyResult();
623
623
  function parse(url, options = {}) {
624
- return parseImpl(url, 5 /* ALL */, suffixLookup, options, getEmptyResult());
624
+ return parseImpl(url, 5 /* FLAG.ALL */, suffixLookup, options, getEmptyResult());
625
625
  }
626
626
  function getHostname(url, options = {}) {
627
627
  /*@__INLINE__*/ resetResult(RESULT);
628
- return parseImpl(url, 0 /* HOSTNAME */, suffixLookup, options, RESULT).hostname;
628
+ return parseImpl(url, 0 /* FLAG.HOSTNAME */, suffixLookup, options, RESULT).hostname;
629
629
  }
630
630
  function getPublicSuffix(url, options = {}) {
631
631
  /*@__INLINE__*/ resetResult(RESULT);
632
- return parseImpl(url, 2 /* PUBLIC_SUFFIX */, suffixLookup, options, RESULT)
632
+ return parseImpl(url, 2 /* FLAG.PUBLIC_SUFFIX */, suffixLookup, options, RESULT)
633
633
  .publicSuffix;
634
634
  }
635
635
  function getDomain(url, options = {}) {
636
636
  /*@__INLINE__*/ resetResult(RESULT);
637
- return parseImpl(url, 3 /* DOMAIN */, suffixLookup, options, RESULT).domain;
637
+ return parseImpl(url, 3 /* FLAG.DOMAIN */, suffixLookup, options, RESULT).domain;
638
638
  }
639
639
  function getSubdomain(url, options = {}) {
640
640
  /*@__INLINE__*/ resetResult(RESULT);
641
- return parseImpl(url, 4 /* SUB_DOMAIN */, suffixLookup, options, RESULT)
641
+ return parseImpl(url, 4 /* FLAG.SUB_DOMAIN */, suffixLookup, options, RESULT)
642
642
  .subdomain;
643
643
  }
644
644
  function getDomainWithoutSuffix(url, options = {}) {
645
645
  /*@__INLINE__*/ resetResult(RESULT);
646
- return parseImpl(url, 5 /* ALL */, suffixLookup, options, RESULT)
646
+ return parseImpl(url, 5 /* FLAG.ALL */, suffixLookup, options, RESULT)
647
647
  .domainWithoutSuffix;
648
648
  }
649
649