Options
All
  • Public
  • Public/Protected
  • All
Menu

External module @creditkarma/mimic-core

Index

Type aliases

IClient

IClient: function

Type declaration

IResponses

IResponses: IUniq<IUniq<any>>

Variables

Const configDir

configDir: string = path.join(homedir(), ".Mimic")

Functions

Const deleteConfig

  • deleteConfig(filePath: string): Promise<Object>
  • Delete file from config directory

    Parameters

    • filePath: string

      file path relatively to config root

    Returns Promise<Object>

detectGit

  • detectGit(directory: string, callback: function, iter?: number): void
  • Parameters

    • directory: string
    • callback: function
        • (err: Error | null, git?: IGit): void
        • Parameters

          • err: Error | null
          • Optional git: IGit

          Returns void

    • Default value iter: number = 0

    Returns void

Const emptyConfigFolder

  • emptyConfigFolder(folder: string): Promise<Object>
  • Delete all files in config directory

    Parameters

    • folder: string

      folder path relatively to config root

    Returns Promise<Object>

ensureDirectory

  • ensureDirectory(dirPath: string, callback: function): void
  • Ensures all directories of the path are created

    Parameters

    • dirPath: string
    • callback: function
        • (err: Error | null): void
        • Parameters

          • err: Error | null

          Returns void

    Returns void

Const mapValues

  • mapValues<V, T>(object: T, callback: function): Record<keyof T, V>
  • Creates an object with the same keys as object and values generated by running callback function

    Type parameters

    • V

    • T

    Parameters

    • object: T
    • callback: function
        • (value: T[keyof T], key: keyof T, obj: T): V
        • Parameters

          • value: T[keyof T]
          • key: keyof T
          • obj: T

          Returns V

    Returns Record<keyof T, V>

Const pick

  • pick<T, K>(object: T, ...keys: K[]): Pick<T, K>
  • Creates an object composed of the picked object properties.

    Type parameters

    • T

    • K: keyof T

    Parameters

    • object: T
    • Rest ...keys: K[]

    Returns Pick<T, K>

raceSuccess

  • raceSuccess<S>(promises: Array<Promise<S>>): Promise<S>
  • Race untill first success

    Type parameters

    • S

    Parameters

    • promises: Array<Promise<S>>

    Returns Promise<S>

Const randomItem

  • randomItem<S>(items: S[] | ReadonlyArray<S>): S
  • Get random item from array

    Type parameters

    • S

    Parameters

    • items: S[] | ReadonlyArray<S>

    Returns S

readAnyFile

  • readAnyFile(filePaths: string[]): Promise<object>

Const readConfig

  • readConfig(filePath: string): Promise<any>
  • Read and parse file from config directory

    Parameters

    • filePath: string

      file path relatively to config root

    Returns Promise<any>

Const readConfigFolder

  • readConfigFolder(folder: string): Promise<IUniq<any>>
  • Read and parse files from config directory

    Parameters

    • folder: string

      folder path relatively to config root

    Returns Promise<IUniq<any>>

readFileAsync

  • readFileAsync(filepath: string): Promise<string>
  • Read file and return Promise

    Parameters

    • filepath: string

      full path to the file

    Returns Promise<string>

readGitMeta

  • readGitMeta(root: string, callback: function): void
  • Read Git information

    Parameters

    • root: string

      root folder

    • callback: function
        • (err: Error | null, git?: IGit): void
        • Parameters

          • err: Error | null
          • Optional git: IGit

          Returns void

    Returns void

Const readRecursively

  • readRecursively(fsPath: string, ext?: string): Promise<object>
  • Read directory recursively

    Parameters

    • fsPath: string
    • Default value ext: string = ""

    Returns Promise<object>

Const toCallback

  • toCallback<S>(promise: Promise<S>, callback: function): void
  • Converts promise to callback

    Type parameters

    • S

    Parameters

    • promise: Promise<S>
    • callback: function
        • (error: Error | null, args?: S): void
        • Parameters

          • error: Error | null
          • Optional args: S

          Returns void

    Returns void

Const writeConfig

  • writeConfig(filePath: string, data: any): Promise<Object>
  • Write file into config folder and create parent directory if necessary

    Parameters

    • filePath: string

      file path relatively to config root

    • data: any

      data to store in config

    Returns Promise<Object>

Const writeConfigFolder

  • writeConfigFolder(folder: string, data: IUniq<any>, ext?: string): Promise<Object>
  • Write files into config folder and create parent directory if necessary

    Parameters

    • folder: string
    • data: IUniq<any>

      data to store in config files

    • Default value ext: string = "json"

      file extensions to create

    Returns Promise<Object>

Generated using TypeDoc