tldts 5.7.111 → 6.0.0

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.
@@ -30,11 +30,11 @@ function lookupInTrie(
30
30
  let node: ITrie | undefined = trie;
31
31
  while (node !== undefined) {
32
32
  // We have a match!
33
- if ((node.$ & allowedMask) !== 0) {
33
+ if ((node[0] & allowedMask) !== 0) {
34
34
  result = {
35
35
  index: index + 1,
36
- isIcann: node.$ === RULE_TYPE.ICANN,
37
- isPrivate: node.$ === RULE_TYPE.PRIVATE,
36
+ isIcann: node[0] === RULE_TYPE.ICANN,
37
+ isPrivate: node[0] === RULE_TYPE.PRIVATE,
38
38
  };
39
39
  }
40
40
 
@@ -43,10 +43,8 @@ function lookupInTrie(
43
43
  break;
44
44
  }
45
45
 
46
- const succ: {
47
- [label: string]: ITrie;
48
- } = node.succ;
49
- node = succ && (succ[parts[index]] || succ['*']);
46
+ const succ: { [label: string]: ITrie } = node[1];
47
+ node = succ[parts[index]!] ?? succ['*'];
50
48
  index -= 1;
51
49
  }
52
50
 
@@ -61,15 +59,15 @@ export default function suffixLookup(
61
59
  options: ISuffixLookupOptions,
62
60
  out: IPublicSuffix,
63
61
  ): void {
64
- if (fastPathLookup(hostname, options, out) === true) {
62
+ if (fastPathLookup(hostname, options, out)) {
65
63
  return;
66
64
  }
67
65
 
68
66
  const hostnameParts = hostname.split('.');
69
67
 
70
68
  const allowedMask =
71
- (options.allowPrivateDomains === true ? RULE_TYPE.PRIVATE : 0) |
72
- (options.allowIcannDomains === true ? RULE_TYPE.ICANN : 0);
69
+ (options.allowPrivateDomains ? RULE_TYPE.PRIVATE : 0) |
70
+ (options.allowIcannDomains ? RULE_TYPE.ICANN : 0);
73
71
 
74
72
  // Look for exceptions
75
73
  const exceptionMatch = lookupInTrie(
@@ -106,5 +104,5 @@ export default function suffixLookup(
106
104
  // public suffix of `hostname` (e.g.: 'example.org' => 'org').
107
105
  out.isIcann = false;
108
106
  out.isPrivate = false;
109
- out.publicSuffix = hostnameParts[hostnameParts.length - 1];
107
+ out.publicSuffix = hostnameParts[hostnameParts.length - 1] ?? null;
110
108
  }