Function parse

  • The url.parse() method takes a URL string, parses it, and returns a URL object.

    A TypeError is thrown if urlString is not a string.

    A URIError is thrown if the auth property is present but cannot be decoded.

    Use of the legacy url.parse() method is discouraged. Users should use the WHATWG URL API. Because the url.parse() method uses a lenient, non-standard algorithm for parsing URL strings, security issues can be introduced. Specifically, issues with host name spoofing and incorrect handling of usernames and passwords have been identified.

    Deprecation of this API has been shelved for now primarily due to the the inability of the WHATWG API to parse relative URLs. Discussions are ongoing for the best way to resolve this.

    Since

    v0.1.25

    Parameters

    • urlString: string

      The URL string to parse.

    Returns "url".UrlWithStringQuery

  • Parameters

    • urlString: string
    • parseQueryString: false
    • Optional slashesDenoteHost: boolean

    Returns "url".UrlWithStringQuery

  • Parameters

    • urlString: string
    • parseQueryString: true
    • Optional slashesDenoteHost: boolean

    Returns "url".UrlWithParsedQuery

  • Parameters

    • urlString: string
    • parseQueryString: boolean
    • Optional slashesDenoteHost: boolean

    Returns "url".Url

  • The url.parse() method takes a URL string, parses it, and returns a URL object.

    A TypeError is thrown if urlString is not a string.

    A URIError is thrown if the auth property is present but cannot be decoded.

    Use of the legacy url.parse() method is discouraged. Users should use the WHATWG URL API. Because the url.parse() method uses a lenient, non-standard algorithm for parsing URL strings, security issues can be introduced. Specifically, issues with host name spoofing and incorrect handling of usernames and passwords have been identified.

    Deprecation of this API has been shelved for now primarily due to the the inability of the WHATWG API to parse relative URLs. Discussions are ongoing for the best way to resolve this.

    Since

    v0.1.25

    Parameters

    • urlString: string

      The URL string to parse.

    Returns "url".UrlWithStringQuery

  • Parameters

    • urlString: string
    • parseQueryString: false
    • Optional slashesDenoteHost: boolean

    Returns "url".UrlWithStringQuery

  • Parameters

    • urlString: string
    • parseQueryString: true
    • Optional slashesDenoteHost: boolean

    Returns "url".UrlWithParsedQuery

  • Parameters

    • urlString: string
    • parseQueryString: boolean
    • Optional slashesDenoteHost: boolean

    Returns "url".Url

Generated using TypeDoc