@yesstudio/yes-utils
    Preparing search index...

    Function toUrl

    • Creates a new URL object from a given string.

      Parameters

      • string: string

        The string to parse into a URL.

      Returns URL

      Returns a new URL object.

      const url = toUrl('https://example.com')
      console.log(url.hostname) // => 'example.com'

      Will throw a TypeError if the input string is not a valid URL.