Interface IConfigDefaultCheck<T, V, C>

The default values with a check function

interface IConfigDefaultCheck<T, V, C> {
    blkVal?: boolean;
    dfVal?: ((value: any) => boolean);
    fb?: keyof T | keyof C | (keyof T | keyof C)[];
    isVal?: IConfigCheckFn<V>;
    mrg?: boolean;
    rdOnly?: boolean;
    ref?: boolean;
    set?: IConfigSetFn<T, V>;
    v?: V | IConfigDefaults<V, T>;
}

Type Parameters

Properties

blkVal?: boolean

Block the value associated with this property from having it's properties / values converted into dynamic properties, this is generally used to block objects or arrays provided by external libraries which may be a plain object with readonly (non-configurable) or const properties.

dfVal?: ((value: any) => boolean)

Use this check to determine the default fallback, default only checked whether the property isDefined, therefore null; "" are considered to be valid values.

fb?: keyof T | keyof C | (keyof T | keyof C)[]

The default fallback key if the main key is not present, this is the key value from the config

isVal?: IConfigCheckFn<V>

Callback function to check if the user-supplied value is valid, if not the default will be applied

mrg?: boolean

Specify that any provided value should have the default value(s) merged into the value rather than just using either the default of user provided values. Mergeed objects will automatically be marked as referenced.

rdOnly?: boolean

Set this field of the target as read-only, which will block this single named property from ever being changed for the target instance. This does NOT freeze or seal the instance, it just stops the direct re-assignment of the named property, if the value is a non-primitive (ie. an object or array) it's properties will still be mutable.

The referenced properties current value

ref?: boolean

Set this field of the target as referenced, which will cause any object or array instance to be updated in-place rather than being entirely replaced. All other values will continue to be replaced. This is required for nested default objects to avoid multiple repetitive updates to listeners

The referenced properties current value

set?: IConfigSetFn<T, V>

Optional function to allow converting and setting of the default value

The default value to apply if the user-supplied value is not valid