Options
All
  • Public
  • Public/Protected
  • All
Menu

API Class for manipulating config layers.

Hierarchy

Index

Constructors

Properties

Methods

Constructors

constructor

Properties

Protected mConfig

mConfig: Config

Methods

activate

  • activate(user: boolean, global: boolean, inDir?: string): void
  • Select which layer is the currently active layer.

    Parameters

    • user: boolean

      True if you want the user layer.

    • global: boolean

      True if you want the global layer.

    • Optional inDir: string

      The directory to which you want to set the file path for this layer.

    Returns void

find

  • find(profileName: string): { global: boolean; user: boolean }
  • Finds the highest priority layer where a profile is stored.

    Parameters

    • profileName: string

      Profile name to search for

    Returns { global: boolean; user: boolean }

    User and global properties, or undefined if profile does not exist

    • global: boolean
    • user: boolean

get

merge

  • Merge properties from the supplied Config object into the active layer. If dryRun is specified, merge is applied to a copy of the layer and returned. If dryRun is not specified, merge is applied directly to the layer and nothing is returned.

    Parameters

    • cnfg: IConfig

      The Config object to merge.

    • Default value dryRun: boolean = false

    Returns void | IConfigLayer

    The merged config layer or void

read

  • read(opts?: { global: boolean; user: boolean }): Promise<void>
  • Read a config layer from disk into memory for application use.

    Parameters

    • Optional opts: { global: boolean; user: boolean }

      The user and global flags that indicate which of the four config files (aka layers) is to be read.

      • global: boolean
      • user: boolean

    Returns Promise<void>

set

write

  • write(opts?: { global: boolean; user: boolean }): Promise<void>

Generated using TypeDoc