Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "utils"

Index

Variables

Let ctr

ctr: number = 5

Functions

clearScreen

  • clearScreen(reset?: boolean): void
  • Clear Screen : Clears the screen and resets cursor. PLACEHOLDER future use.

    Parameters

    • Default value reset: boolean = true

      when not false cursor is reset.

    Returns void

concatTo

  • concatTo(obj: any, key: string, val: any[]): any
  • Concat To : Helper method to ensure array in object property then concat values.

    Parameters

    • obj: any

      the object collection containing keys.

    • key: string

      the key to concat values to.

    • val: any[]

      the array of values to concat.

    Returns any

environment

  • environment(): object
  • Env Paths : Gets paths for the environment including executed path.

    Returns object

    • CWD: string
    • EXEC: string
    • EXEC_PATH: string
    • HOME_PATH: string
    • NODE_ENV: string
    • NODE_PATH: string
    • PKG: any
    • PLATFORM: "aix" | "android" | "darwin" | "freebsd" | "linux" | "openbsd" | "sunos" | "win32" | "cygwin"

findPackage

  • findPackage(filename?: any): any
  • Parameters

    • Optional filename: any

    Returns any

isDotNotation

  • isDotNotation(val: any): boolean
  • Is Dot Notation : Tests if value is dot notated string.

    Parameters

    • val: any

      the value to be inspected.

    Returns boolean

isExecutable

  • isExecutable(path: string): boolean
  • Is Executable : Tests if path is executable.

    Parameters

    • path: string

      the path to the executable.

    Returns boolean

isFlag

  • isFlag(val: string): boolean
  • Is Flag : Checks if value is a flag (ex: -s or --save).

    Parameters

    • val: string

      the value to inspect.

    Returns boolean

isVariadic

  • isVariadic(val: string): boolean
  • Is Spread : Tests if command token is spread type.

    Parameters

    • val: string

      the value to test.

    Returns boolean

levenshtein

  • levenshtein(source: any, compare: any): any
  • Levenshtein : Computes the edit distance between two strings.

    Based on gist by Andrei Mackenzie

    see

    https://gist.github.com/andrei-m/982927

    Parameters

    • source: any

      the source string.

    • compare: any

      the string to be compared.

    Returns any

mergeArgs

  • mergeArgs(val: any | any[], ...args: any[]): any[]
  • Merge Args : Merges arguments into single array of values.

    Parameters

    • val: any | any[]

      the single value or array of values.

    • Rest ...args: any[]

      rest param of args.

    Returns any[]

removeDuplicates

  • removeDuplicates(...args: any[]): any[]
  • Remove Duplicates : Removes any duplicate elements in an array.

    Parameters

    • Rest ...args: any[]

      the array of elements to be inspected.

    Returns any[]

setBlocking

  • setBlocking(blocking?: boolean): void

setEnumerable

  • setEnumerable(ctx: object, props: string | string[], state?: boolean): void
  • Set Enumerable : Simple helper for defining enumerable prop states.

    Parameters

    • ctx: object

      the context to define properties on.

    • props: string | string[]

      the properties to set enumerable for.

    • Default value state: boolean = false

      the state true or false.

    Returns void

splitToList

  • splitToList(val: string): RegExp
  • Split To List : Takes a list 'small, medium, large' and converts it to expression like /^(small|medium|large)$/i

    Parameters

    • val: string

      the value to convert.

    Returns RegExp

stripToken

  • stripToken(val: string, exp?: RegExp): string
  • Strip Param : Strips -f, --flag [param] resulting in f, flag or param.

    Parameters

    • val: string

      the value to be stripped.

    • Optional exp: RegExp

    Returns string

toOptionToken

  • toOptionToken(token: string): string
  • To Option Tokens : Formats option string to support Pargv syntax.

    example

    coverts: 'command' to: '[command]'

    converts: '-n, --name ' to: '-n.--name '

    Parameters

    • token: string

      the string to insepct.

    Returns string

Generated using TypeDoc