How to use the tldts-core.fastPathLookup function in tldts-core

To help you get started, we’ve selected a few tldts-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github remusao / tldts / packages / tldts-experimental / src / packed-hashes.ts View on Github external
export default function suffixLookup(
  hostname: string,
  options: ISuffixLookupOptions,
  out: IPublicSuffix,
): void {
  if (fastPathLookup(hostname, options, out) === true) {
    return;
  }

  const { allowIcannDomains, allowPrivateDomains } = options;

  // Keep track of longest match
  let matchIndex = -1;
  let matchKind = Result.NO_MATCH;
  let matchLabels = 0; // Keep track of number of labels currently matched

  // Index in the packed array data-structure
  let index = 1;

  const numberOfHashes = hashHostnameLabelsBackward(
    hostname,
    packed[0] /* maximumNumberOfLabels */,