Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace URLExt

The namespace for URL-related functions.

Index

Functions

encodeParts

  • encodeParts(url: string): string
  • Encode the components of a multi-segment url.

    Parameters

    • url: string

      The url to encode.

    Returns string

    the encoded url.

    Notes

    Preserves the '/' separators. Should not include the base url, since all parts are escaped.

getHostName

  • getHostName(url: string): string
  • Parse URL and retrieve hostname

    Parameters

    • url: string

      The URL string to parse

    Returns string

    a hostname string value

isLocal

  • isLocal(url: string): boolean
  • Test whether the url is a local url.

    Notes

    This function returns false for any fully qualified url, including data:, file:, and // protocol URLs.

    Parameters

    • url: string

    Returns boolean

join

  • join(...parts: string[]): string
  • Join a sequence of url components and normalizes as in node path.join.

    Parameters

    • Rest ...parts: string[]

      The url components.

    Returns string

    the joined url.

normalize

  • normalize(url: string): string
  • normalize(url: undefined): undefined
  • normalize(url: string | undefined): string | undefined
  • Normalize a url.

    Parameters

    • url: string

    Returns string

  • Parameters

    • url: undefined

    Returns undefined

  • Parameters

    • url: string | undefined

    Returns string | undefined

objectToQueryString

  • objectToQueryString(value: PartialJSONObject): string
  • Return a serialized object string suitable for a query.

    Parameters

    • value: PartialJSONObject

    Returns string

    an encoded url query.

    Notes

    Modified version of stackoverflow.

parse

  • parse(url: string): IUrl
  • Parse a url into a URL object.

    Parameters

    • url: string

    Returns IUrl

    A URL object.

queryStringToObject

  • queryStringToObject(value: string): {}
  • Return a parsed object that represents the values in a query string.

    Parameters

    • value: string

    Returns {}

    • [key: string]: string | undefined

Generated using TypeDoc