Documentation
    Preparing search index...

    Class Conf<Schema>

    Simple config handling for your app or module.

    Type Parameters

    • Schema extends StandardSchemaV1
    Index

    Constructors

    Properties

    events: EventTarget
    path: string

    Accessors

    • get size(): number

      Number of top-level config items.

      Returns number

    Methods

    • Close the file watcher if one exists.

      Useful in tests to prevent the process from hanging.

      Returns void

    • Append an item to an array config value.

      Creates the array when the key does not exist.

      Type Parameters

      • Key extends string | number | symbol | string & Record<never, never>

      Parameters

      Returns void

    • Reset the config to schema default values.

      Returns void

    • Get a config item.

      Type Parameters

      • Key extends string | number | symbol | string & Record<never, never>

      Parameters

      • key: Key

        Item key. Supports dot notation when enabled.

      Returns SchemaValue<Schema, Key>

    • Get a config item, falling back to a default value when missing.

      Type Parameters

      • Key extends string | number | symbol | string & Record<never, never>
      • DefaultValue

      Parameters

      • key: Key

        Item key. Supports dot notation when enabled.

      • defaultValue: DefaultValue

        Value returned when the item does not exist.

      Returns DefaultValue | Exclude<SchemaValue<Schema, Key>, undefined>

    • Set one or more config items.

      Type Parameters

      • Key extends string | number | symbol | string & Record<never, never>

      Parameters

      Returns void

    • Set multiple config items.

      Parameters

      Returns void