Skip to main content

TraitUtil

Index

Constructors

constructor

Methods

staticsafeArray

  • safeArray(value: any): any[]
  • Provides safe array creation from a given input.


    Parameters

    • value: any

      A value to potentially convert into a safe array.

    Returns any[]

staticsafeName

  • safeName(object: any, defaultName?: string): string
  • Provides a utility method that defers to object.name if it exists or fallback to defaultName or anonymous.


    Parameters

    • object: any

      The target object to provide safe name coverage.

    • defaultName: string = ""

      A default name to fallback to if object.name is missing.

    Returns string

staticsafeValue

  • safeValue(object: any, defaultValue?: string): string
  • Provides a utility method that defers to object.value if it exists or fallback to defaultValue or anonymous.


    Parameters

    • object: any

      The target object to provide safe name coverage.

    • defaultValue: string = ""

      A default value to fallback to if object.value is missing.

    Returns string