Options
All
  • Public
  • Public/Protected
  • All
Menu

An abstract class that implements all the config management functions but none of the storage functions.

Note: To see the interface, look in typescripts autocomplete help or the npm package's ConfigStore.d.ts file.

implements

{ConfigStore}

Type parameters

Hierarchy

Implements

Index

Constructors

constructor

  • Parameters

    • options: T

    Returns BaseConfigStore

Properties

Protected options

options: T

Methods

awaitEach

  • awaitEach(actionFn: function): Promise<void>
  • Asynchronously invokes actionFn once for each key-value pair present in the config object.

    Parameters

    • actionFn: function

      The function (key: string, value: ConfigValue) => Promise<void> to be called for each element.

        • Parameters

          Returns Promise<void>

    Returns Promise<void>

clear

  • clear(): void
  • Removes all key/value pairs from the config object.

    Returns void

entries

forEach

  • forEach(actionFn: function): void
  • Invokes actionFn once for each key-value pair present in the config object.

    Parameters

    • actionFn: function

      The function (key: string, value: ConfigValue) => void to be called for each element.

    Returns void

get

  • Returns the value associated to the key, or undefined if there is none.

    Parameters

    • key: string

      The key.

    Returns Optional<ConfigValue>

getContents

getKeysByValue

  • Returns the list of keys that contain a value.

    Parameters

    Returns string[]

has

  • has(key: string): boolean
  • Returns a boolean asserting whether a value has been associated to the key in the config object or not.

    Parameters

    • key: string

      The key.

    Returns boolean

Protected Abstract init

  • init(): Promise<void>
  • Asynchronously initializes newly constructed instances of a concrete subclass.

    Returns Promise<void>

keys

  • keys(): string[]
  • Returns an array that contains the keys for each element in the config object.

    Returns string[]

set

  • Sets the value for the key in the config object.

    Parameters

    Returns ConfigContents

    Returns the config object.

setContents

  • Sets the entire config contents.

    Parameters

    Returns void

setContentsFromObject

  • setContentsFromObject<U>(obj: U): void
  • Convert an object to a ConfigContents and set it as the config contents.

    Type parameters

    • U: any

    Parameters

    • obj: U

      The object.

    Returns void

toObject

  • toObject(): JsonMap
  • Convert the config object to a JSON object.

    Returns JsonMap

    Returns the config contents. Same as calling ConfigStore.getContents

unset

  • unset(key: string): boolean
  • Returns true if an element in the config object existed and has been removed, or false if the element does not exist. {@link BaseConfigStore.has(key)} will return false afterwards.

    Parameters

    • key: string

      The key.

    Returns boolean

unsetAll

  • unsetAll(keys: string[]): boolean
  • Returns true if all elements in the config object existed and have been removed, or false if all the elements do not exist (some may have been removed). {@link BaseConfigStore.has(key)} will return false afterwards.

    Parameters

    • keys: string[]

      The keys.

    Returns boolean

values

  • Returns an array that contains the values for each element in the config object.

    Returns ConfigValue[]

Static create

  • create<P, T>(this: object, options: P): Promise<T>
  • Asynchronously constructs and initializes a new instance of a concrete subclass with the provided options.

    Type parameters

    • P

    • T: AsyncCreatable<P>

    Parameters

    • this: object
    • options: P

      An options object providing initialization params to the async constructor.

    Returns Promise<T>