Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "helpers"

Index

Type aliases

SimpleCompletedAction

SimpleCompletedAction: function

Describes a simple 'completed' action.

param

The occurred error.

param

The result.

Type declaration

    • (err: any, result?: TResult): void
    • Parameters

      • err: any
      • Optional result: TResult

      Returns void

Functions

asArray

  • asArray<T>(val: T | T[], removeEmpty?: boolean): T[]
  • Returns a value as array.

    Type parameters

    • T

    Parameters

    • val: T | T[]

      The value.

    • Default value removeEmpty: boolean = true

    Returns T[]

    The value as (new) array.

asUTC

  • asUTC(val: any): Moment.Moment
  • Returns a value as UTC Moment instance.

    Parameters

    • val: any

      The input value.

    Returns Moment.Moment

    The output value.

cloneObject

  • cloneObject<T>(val: T): T
  • Clones an object / value deep.

    Type parameters

    • T

    Parameters

    • val: T

      The value / object to clone.

    Returns T

    The cloned value / object.

createCompletedAction

  • Creates a simple 'completed' callback for a promise.

    Type parameters

    • TResult

    Parameters

    • resolve: function

      The 'succeeded' callback.

        • (value?: TResult | PromiseLike<TResult>): void
        • Parameters

          • Optional value: TResult | PromiseLike<TResult>

          Returns void

    • Optional reject: function

      The 'error' callback.

        • (reason: any): void
        • Parameters

          • reason: any

          Returns void

    Returns SimpleCompletedAction<TResult>

    The created action.

isEmptyString

  • isEmptyString(val: any): boolean
  • Checks if the string representation of a value is empty or contains whitespaces only.

    Parameters

    • val: any

      The value to check.

    Returns boolean

    Is empty or not.

normalizePath

  • normalizePath(p: string): string
  • Normalizes a path.

    Parameters

    • p: string

      The path to normalize.

    Returns string

    The normalized path.

normalizeString

  • normalizeString(val: any): string
  • Normalizes a value as string so that is comparable.

    Parameters

    • val: any

      The value to convert.

    Returns string

    The normalized value.

readAll

  • readAll(stream: Stream.Readable, enc?: string): Promise<Buffer>
  • Reads the content of a stream.

    Parameters

    • stream: Stream.Readable

      The stream.

    • Optional enc: string

    Returns Promise<Buffer>

    The promise with the content.

toBooleanSafe

  • toBooleanSafe(val: any, defaultVal?: boolean): boolean
  • Returns a value as boolean, which is not (null) and (undefined).

    Parameters

    • val: any

      The value to convert.

    • Default value defaultVal: boolean = false

    Returns boolean

    'val' as boolean.

toStringSafe

  • toStringSafe(val: any, defaultVal?: string): string
  • Returns a value as string, which is not (null) and (undefined).

    Parameters

    • val: any

      The value to convert.

    • Default value defaultVal: string = ""

    Returns string

    'val' as string.

tryRemoveListener

  • tryRemoveListener(obj: EventEmitter, ev: string | symbol, listener: Function): boolean
  • Tries to remove a listener from an event emitter.

    Parameters

    • obj: EventEmitter

      The emitter.

    • ev: string | symbol

      The event.

    • listener: Function

      The listener.

    Returns boolean

    Operation was successfull or not.

write

  • write(msg: any, stream?: WritableStream): void
  • Writes a message to a stream.

    Parameters

    • msg: any

      The message to write.

    • Optional stream: WritableStream

    Returns void

write_err

  • write_err(msg: any): void
  • Writes a message to stderr.

    Parameters

    • msg: any

      The message to write.

    Returns void

write_err_ln

  • write_err_ln(msg?: any): void
  • Writes an optional message to stderr and appends a new line.

    Parameters

    • Optional msg: any

    Returns void

write_ln

  • write_ln(msg?: any, stream?: WritableStream): void
  • Writes an optional message to a stream and appends a new line.

    Parameters

    • Optional msg: any
    • Optional stream: WritableStream

    Returns void

Generated using TypeDoc