Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "utils"

Index

Functions

asArray

  • asArray<T>(val: T | T[]): T[]
  • Keeps sure to return a value as array.

    Type parameters

    • T

    Parameters

    • val: T | T[]

      The input value.

    Returns T[]

    The output value.

compareValuesBy

  • compareValuesBy<T, V>(x: T, y: T, selector: function): number
  • Compares two values for sorting, by using a selector.

    Type parameters

    • T

    • V

    Parameters

    • x: T

      The first value.

    • y: T

      The second value.

    • selector: function

      The function, that selects the value to compare.

        • (i: T): V
        • Parameters

          • i: T

          Returns V

    Returns number

    The soirt value.

isEmptyString

  • isEmptyString(val: any): boolean
  • Converts a value to a normalized string and checks if it is empty ('').

    Parameters

    • val: any

      The value to check.

    Returns boolean

    Is empty string ('') or not.

normalizeString

  • normalizeString(val: any): string
  • Converts a value to a lower case and trimmed string.

    Parameters

    • val: any

      The input value.

    Returns string

    The output value.

sortObjectByKey

  • sortObjectByKey<T>(obj: any): T
  • Creates a cloned version of an object with sorted keys.

    Type parameters

    • T

    Parameters

    • obj: any

      The input object.

    Returns T

    The output object with sorted keys.

toStringSafe

  • toStringSafe(val: any): string
  • Converts a value to a string, if needed, that is not (null) and (undefined).

    Parameters

    • val: any

      The input value.

    Returns string

    The output value.

yamlOrJson

  • yamlOrJson<T>(serializedData: string, debug?: boolean): T | false
  • Tries to parse an object as YAML or JSON.

    Type parameters

    • T

    Parameters

    • serializedData: string

      The serialized (string) data.

    • Default value debug: boolean = false

    Returns T | false

    The parsed object or (false) if parsing failed.

Generated using TypeDoc