Stone.js API
    Preparing search index...

    Class Config<TObject>

    Class representing a Config.

    Mr. Stone evensstone@gmail.com

    Type Parameters

    • TObject extends object = Record<PropertyKey, unknown>

    Hierarchy (View Summary)

    Index
    • Create a Config.

      Type Parameters

      • TObject extends object = Record<PropertyKey, unknown>

      Parameters

      • Optionalitems: any

        Initial configuration items.

      Returns Config<TObject>

    • Add a value to an existing configuration key.

      Type Parameters

      • TValue

      Parameters

      • key: PropertyKey

        The key or keys to set as defaults.

      • value: TValue

        The value to set as default.

      Returns this

      The current Config instance.

    • Get all of the configuration items as a literal object.

      Returns TObject

      All configuration items.

    • Clear all of the configuration items.

      Returns this

      The current Config instance.

    • Get the first match configuration value.

      Type Parameters

      • TReturn = unknown

      Parameters

      • keys: PropertyKey[]

        An array of keys to check.

      Returns TReturn

      The first matching configuration value.

    • Get the first match configuration value.

      Type Parameters

      • TReturn = unknown

      Parameters

      • keys: PropertyKey[]

        An array of keys to check.

      • fallback: TReturn

        The fallback value if no key matches.

      Returns TReturn

      The first matching configuration value.

    • Get the specified configuration value.

      Type Parameters

      • TReturn = unknown

      Parameters

      • key: PropertyKey

        The key or keys to retrieve from the configuration.

      Returns TReturn

      The configuration value.

    • Get the specified configuration value.

      Type Parameters

      • TReturn = unknown

      Parameters

      • key: PropertyKey

        The key or keys to retrieve from the configuration.

      • fallback: TReturn

        The fallback value if the key does not exist.

      Returns TReturn

      The configuration value.

    • Get many configuration values.

      Type Parameters

      • TReturn = Record<PropertyKey, unknown>

      Parameters

      • keys: Record<PropertyKey, unknown> | PropertyKey[]

        The keys to retrieve from the configuration.

      Returns TReturn

      An object containing the requested configuration values.

    • Determine if the given configuration value exists.

      Parameters

      • key: PropertyKey | PropertyKey[]

        The key or keys to check.

      Returns boolean

      True if the key exists, false otherwise.

    • Determine if the given configuration value does not exist.

      Parameters

      • key: PropertyKey | PropertyKey[]

        The key or keys to check.

      Returns boolean

      True if the key does not exist, false otherwise.

    • Check if the given configuration value is equal to the specified value.

      Parameters

      • key: PropertyKey

        The key to check.

      • value: unknown

        The value to compare against.

      Returns boolean

      True if the key's value is equal to the specified value, false otherwise.

    • Check if the given configuration value is not equal to the specified value.

      Parameters

      • key: PropertyKey

        The key to check.

      • value: unknown

        The value to compare against.

      Returns boolean

      True if the key's value is not equal to the specified value, false otherwise.

    • Set a given configuration value.

      Type Parameters

      • TValue

      Parameters

      • key:
            | PropertyKey
            | PropertyKey[]
            | Record<string, TValue>
            | Record<PropertyKey, TValue>

        The key or keys to set in the configuration.

      • Optionalvalue: TValue

        The value to set.

      Returns this

      The current Config instance.

    • Set a given configuration value if it does not exist.

      Type Parameters

      • TValue

      Parameters

      • key: PropertyKey | PropertyKey[]

        The key or keys to set in the configuration.

      • Optionalvalue: TValue

        The value to set.

      Returns this

      The current Config instance.

    • Set all of the configuration items.

      Parameters

      • items: TObject

        The configuration items.

      Returns this

      The current Config instance.

    • Get all of the configuration items as a JSON string.

      Returns string

      All configuration items as a JSON string.

    • Create a Config.

      Type Parameters

      • TObject extends object = Record<PropertyKey, unknown>

      Parameters

      • Optionalitems: TObject

        Initial configuration items.

      Returns Config<TObject>

      A new Config instance.

    • Create a Config from a JSON string.

      Type Parameters

      • TObject extends object = Record<PropertyKey, unknown>

      Parameters

      • items: string

        The JSON string to create the Config from.

      Returns Config<TObject>

      A new Config instance.