PageSourceSearch

https://www.ccifrance-international.org/_assets/cru-1790679016/929…/Frontend/js/utility/http.js

js ccifrance-international.org collected 2026-10-02 16:38:57 UTC 555 bytes, 25 lines download raw bytes

1/**
2 * @param {string} uri
3 * @param {boolean} [keepExtension]
4 * @return {string}
5 */
6export function canonicalHostname(uri, keepExtension = true) {
7  uri = uri.trim().toLowerCase()
8  if (uri === '' || !uri.includes('.')) {
9    return ''
10  }
11  if (uri.startsWith('//')) {
12    uri = 'https:' + uri
13  } else if (!/^https?:\/\//.test(uri)) {
14    uri = 'https://' + uri
15  }
16
17  const url = new URL(uri)
18  let hostname = url.hostname.match(/([^.]+\.[^.]+)$/)[1]
19
20  if (!keepExtension) {
21    hostname = hostname.replace(/\.[^.]+$/, '')
22  }
23
24  return hostname
25}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.