Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Functions

documentBase

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

    Returns string

ensureTrailingSlash

  • ensureTrailingSlash(url: string): string
  • ensureTrailingSlash(url: string | undefined): 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: string | undefined

    Returns string | undefined

parseUrl

  • 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

  • urlWithId(url: string, id: string | number | undefined): string
  • urlWithId(url: string | undefined, id: string | number | undefined): 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: string | number | undefined

    Returns string

  • Parameters

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

    Returns string | undefined