Options
All
  • Public
  • Public/Protected
  • All
Menu

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: (i: T) => V): 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: (i: T) => V

      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.

isJoi

  • isJoi<TObj>(val: any): val is TObj
  • Checks if a value is a joi object or not.

    Type parameters

    • TObj: SchemaInternals<TObj> = AnySchema

    Parameters

    • val: any

      The value to check.

    Returns val is TObj

    Is joi object 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.

readAll

  • readAll(stream: NodeJS.ReadStream): Promise<Buffer>
  • Reads all data from a readable stream.

    Parameters

    • stream: NodeJS.ReadStream

      The stream to read.

    Returns Promise<Buffer>

    Promise The promise with the read data.

toBooleanSafe

  • toBooleanSafe(val: any, defaultValue?: boolean): boolean
  • Converts a value to a boolean, if needed.

    Parameters

    • val: any

      The input value.

    • defaultValue: boolean = false

    Returns boolean

    The output value.

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.

Generated using TypeDoc