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[]): T[]
  • Returns a value as array.

    Type parameters

    • T

    Parameters

    • val: T | T[]

      The value.

    Returns T[]

    The value as array.

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.

compareValues

  • compareValues<T>(x: T, y: T): number
  • Compares two values for a sort operation.

    Type parameters

    • T

    Parameters

    • x: T

      The left value.

    • y: T

      The right value.

    Returns number

    The "sort value".

compareValuesBy

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

    Type parameters

    • T

    • U

    Parameters

    • x: T

      The left value.

    • y: T

      The right value.

    • selector: function

      The selector.

        • (t: T): U
        • Parameters

          • t: T

          Returns U

    Returns number

    The "sort value".

createSimpleCompletedAction

  • createSimpleCompletedAction<TResult>(resolve: function, reject?: function): SimpleCompletedAction<TResult>
  • 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.

distinctArray

  • distinctArray<T>(arr: T[]): T[]
  • Removes duplicate entries from an array.

    Type parameters

    • T

    Parameters

    • arr: T[]

      The input array.

    Returns T[]

    The filtered array.

getEOL

  • getEOL(eol?: vscode.EndOfLine): string
  • Returns the End-Of-Line sequence.

    Parameters

    • Optional eol: vscode.EndOfLine

    Returns string

    The sequence.

getHostAndPort

  • getHostAndPort(val: any, defaultPort: number): object
  • Returns host and port from a value.

    Parameters

    • val: any

      The value.

    • defaultPort: number

      The default port.

    Returns object

    The extracted data.

    • host: string
    • port: number

getPortSafe

  • getPortSafe(val: any, defaultPort: number): number
  • Returns a "safe" TCP port value.

    Parameters

    • val: any

      The input value.

    • defaultPort: number

      The value to take if 'val' s invalid.

    Returns number

    The output value.

getProxyName

  • getProxyName(name: string, port: number, nr: number): string
  • Gets the name for a proxy.

    Parameters

    • name: string

      The source string.

    • port: number

      The TCP port.

    • nr: number

      The number.

    Returns string

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.

isNull

  • isNull(val: any): boolean
  • Checks if a value is (null).

    Parameters

    • val: any

      The value to check.

    Returns boolean

    Is (null) or not.

isNullOrUndefined

  • isNullOrUndefined(val: any): boolean
  • Checks if a value is (null) or (undefined).

    Parameters

    • val: any

      The value to check.

    Returns boolean

    Is (null)/(undefined) or not.

isUndefined

  • isUndefined(val: any): boolean
  • Checks if a value is (undefined).

    Parameters

    • val: any

      The value to check.

    Returns boolean

    Is (undefined) or not.

loadModule

  • loadModule<TModule>(file: string, useCache?: boolean): TModule
  • Loads a module.

    Type parameters

    • TModule

    Parameters

    • file: string

      The path of the module's file.

    • Default value useCache: boolean = false

      Use cache or not.

    Returns TModule

    The loaded module.

normalizeString

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

    Parameters

    • val: any

      The value to convert.

    • Optional normalizer: function
        • (str: string): string
        • Parameters

          • str: string

          Returns string

    Returns string

    The normalized value.

toBooleanSafe

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

    Parameters

    • val: any

      The value to convert.

    • Default value defaultValue: any = false

      The value to return if 'val' is (null) or (undefined).

    Returns boolean

    The converted value.

toFullPath

  • toFullPath(path: string): string
  • Converts to a full, clean path.

    Parameters

    • path: string

      The path to convert.

    Returns string

    The full path.

toReadOnlyObject

  • toReadOnlyObject<T>(baseObj: T): T
  • Creates a read-only version of an object.

    Type parameters

    • T

    Parameters

    • baseObj: T

      The base object.

    Returns T

    The read-only version.

toStringSafe

  • toStringSafe(str: any, defValue?: any): string
  • Converts a value to a string that is NOT (null) or (undefined).

    Parameters

    • str: any

      The input value.

    • Default value defValue: any = ""

      The default value.

    Returns string

    The output value.

tryDispose

  • tryDispose(obj: object): boolean
  • Tries to dispose an object.

    Parameters

    • obj: object

      The object to dispose.

      • Optional dispose?: function
          • (): any
          • Returns any

    Returns boolean

    Operation was successful or not.

Generated using TypeDoc