Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Utility

Utility methods.

Hierarchy

  • Utility

Index

Constructors

constructor

  • Returns Utility

Methods

getTypeString

  • getTypeString(): string
  • Returns string

Static clone

  • clone<T>(list: Array<T>): Array<T>
  • Clones the specified list.

    Type parameters

    • T

    Parameters

    • list: Array<T>

      The list.

    Returns Array<T>

Static firstOrDefault

  • firstOrDefault<T>(array: T[]): T
  • firstOrDefault<T>(list: Array<T>): T
  • Gets the first element in the array or the default value if the array is null or empty.

    Type parameters

    • T

    Parameters

    • array: T[]

      The array.

    Returns T

  • Gets the first element in the list or the default value if the list is null or empty.

    Type parameters

    • T

    Parameters

    • list: Array<T>

      The list.

    Returns T

Static formatDoubleAsPercent

  • formatDoubleAsPercent(value: number, decimalPlaces: number): string
  • Formats a double as a percentage string.

    Parameters

    • value: number

      The value.

    • decimalPlaces: number

      The number of decimal places to include.

    Returns string

Static generateSynchronizationSource

  • generateSynchronizationSource(): number
  • Generates a synchronization source.

    Returns number

Static generateTieBreaker

  • generateTieBreaker(): string
  • Generates a Connection Tie-breaker.

    Returns string

Static lastOrDefault

  • lastOrDefault<T>(list: Array<T>): T
  • lastOrDefault<T>(array: T[]): T
  • Gets the last element in the list or the default value if the list is null or empty.

    Type parameters

    • T

    Parameters

    • list: Array<T>

      The list.

    Returns T

  • Gets the last element in the array or the default value if the array is null or empty.

    Type parameters

    • T

    Parameters

    • array: T[]

      The array.

    Returns T

Static toList

  • toList<T>(array: T[]): Array<T>
  • Converts an array to a list.

    Type parameters

    • T

    Parameters

    • array: T[]

      The array.

    Returns Array<T>

Static treeFindLeaves

  • treeFindLeaves<T>(root: T, childrenCallback: IFunction1<T, T[]>, nodeCallback: IAction1<T>): void
  • Enumerates over all nodes in the tree, invoking the callback for each one.
    The generic to search.

    Type parameters

    • T

    Parameters

    • root: T

      The root.

    • childrenCallback: IFunction1<T, T[]>

      The children callback.

    • nodeCallback: IAction1<T>

      The node callback.

    Returns void

Static treeSearch

  • treeSearch<T>(root: T, childrenCallback: IFunction1<T, T[]>, nodeCallback: IAction1<T>): void
  • Enumerates over all nodes in the tree, invoking the callback for each one.
    The generic to search.

    Type parameters

    • T

    Parameters

    • root: T

      The root.

    • childrenCallback: IFunction1<T, T[]>

      The children callback.

    • nodeCallback: IAction1<T>

      The node callback.

    Returns void