Function validateBooleanOrString

Returns a valid boolean or a string from the supplied value, ensuring the supplied value is either a boolean or boolean string (see validateBoolean), or a string that conforms to the given checkFn.

LisnUsageError If the value is invalid.

  • Type Parameters

    • T extends string = string

    Parameters

    • key: string
    • value: unknown
    • OptionalstringCheckFn: (value: string) => value is T

      If given and the supplied value is a string other than a boolean string, then it is called with the value as a single argument. It must return true if the value is valid and false otherwise. If it is not given, then any literal string is accepted.

    Returns undefined | boolean | T