Options
All
  • Public
  • Public/Protected
  • All
Menu

Module utils

The utils module contains various utility interfaces and functions.

Index

Functions

assertNotNull

  • assertNotNull<T>(value: T, propertyName: string, listy?: boolean): void
  • Type parameters

    • T

    Parameters

    • value: T
    • propertyName: string
    • Optional listy: boolean

    Returns void

combineUrl

  • combineUrl(...parts: string[]): string
  • Combines the given parts and returns them as an URL, avoiding duplicate slashes.

    Parameters

    • Rest ...parts: string[]

    Returns string

flatten

  • flatten<T>(array: T[]): T[]
  • Flattens an array of arrays of items of type T, returning a single array that consists of the concatenation of the original arrays.

    Type parameters

    • T

    Parameters

    • array: T[]

    Returns T[]

isBrowser

  • isBrowser(): boolean
  • Returns boolean

isObject

  • isObject(data: any): boolean
  • Parameters

    • data: any

    Returns boolean

randomUuid

  • randomUuid(): string
  • Generates a random UUID to set the ID of an element or unit to. There is no intrinsic ID collision detection/avoidance mechanism but it's good enough in practice.

    Returns string

removeFromArray

  • removeFromArray<T>(list: T[], item: T): void
  • Type parameters

    • T

    Parameters

    • list: T[]
    • item: T

    Returns void

shallowEquals

  • shallowEquals(first: any[], second: any[]): boolean
  • Parameters

    • first: any[]
    • second: any[]

    Returns boolean

Generated using TypeDoc