@eroyeroy/utils - v0.1.0
    Preparing search index...

    Function parseUrl

    • Parses a URL string into a URL object. Returns null if the URL is invalid.

      Parameters

      • url: string

        The URL string to parse.

      Returns URL | null

      parseUrl("https://example.com/path?q=1")?.pathname // => "/path"
      parseUrl("not-a-url") // => null