How to use the tldts.getDomain function in tldts

To help you get started, we’ve selected a few tldts 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 microlinkhq / browserless / packages / goto / src / index.js View on Github external
const parseCookies = (url, str) => {
  const domain = `.${getDomain(url)}`
  return str.split(';').reduce((acc, str) => {
    const [name, value] = str.split('=')
    const cookie = {
      name: name.trim(),
      value,
      domain,
      url,
      path: '/'
    }
    return [...acc, cookie]
  }, [])
}

tldts

Library to work against complex domain names, subdomains and URIs.

MIT
Latest version published 13 days ago

Package Health Score

83 / 100
Full package analysis