• A function that tries to retrieve an environment variable from the process.env object and, if it succeeds, validates that it is either "true" or "false", and, if so, returns it as a boolean value. If no variable is found, this function returns undefined.

    Parameters

    • name: string

      The name of the environment variable to look for in process.env.

    Returns undefined | boolean

    A boolean corresponding to the environment variable's value, if any, else undefined.

    Throws

    An Error instance explaining that the variable was found but that it could not be parsed into a valid boolean.

    See

    asBoolean

    Note

    This function's input is case insensitive, which means that variations of true such as True and TRUE, to quote two examples, will also be treated as true. Moreover, T or t will be treated as true, and, similarly, F and f will be treated as false. Finally, 0 will be treated as false and 1 as true.

Generated using TypeDoc