Class AppDataSection<Val>

A class that represents the appdata section of the JSON file used as simple database.

Type Parameters

Hierarchy

Constructors

Properties

defaultValues: Record<string, Val> = {}

The default values for the section.

The parent JsonFile instance.

isInitialized: boolean = false

Indicates whether the section has been initialized.

keysAreFixed: boolean

Indicates whether the keys in the section are fixed.

name: string

The name of the section.

prefixBaseString: string

The base string used as a prefix for the section.

Accessors

Methods

  • Gets the object path prefix as dot-separated keys for this section of the JSON file database.

    Parameters

    • Optional key: string

      An optional key to append to the prefix path.

    Returns string

    The object path prefix.

    Throws

    An error if the keys are fixed and the specified key does not exist in the default values.

  • Updates the value associated with the specified key.

    Parameters

    • key: string

      The key to set the value for.

    • callback: ((val, key) => Val)

      The callback function that returns the new value.

        • (val, key): Val
        • Parameters

          • val: Val
          • key: string

          Returns Val

    • save: boolean = true

      Indicates whether to save the section after setting the value.

    Returns void

Generated using TypeDoc