Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Functions

  • documentBase(): string
  • Just use document?.baseURI ?? '' for the equivalent functionality in modern browsers.

    Returns string

  • ensureTrailingSlash(url: string): string
  • ensureTrailingSlash(url: undefined | string): string | undefined
  • Adds a trailing / to the string if it does not already end with a /

    It also converts an empty string to ./

    Parameters

    • url: string

    Returns string

  • Parameters

    • url: undefined | string

    Returns string | undefined

  • parseUrl(s: string): URL | HTMLAnchorElement
  • Just use new URL(s, document?.baseURI) for the equivalent functionality in modern browsers.

    Parameters

    • s: string

    Returns URL | HTMLAnchorElement

  • urlWithId(url: string, id: undefined | string | number): string
  • urlWithId(url: undefined | string, id: undefined | string | number): string | undefined
  • Combines a string and an optional second part (typically, REST ID), adding / between them if needed. If the base string is undefined, the function will return undefined regardless of the ID part.

    Parameters

    • url: string
    • id: undefined | string | number

    Returns string

  • Parameters

    • url: undefined | string
    • id: undefined | string | number

    Returns string | undefined