• A function that tries to retrieve an environment variable from the process.env object and, if it succeeds, validates that it can be parsed as an integer, and, if so, returns it as a number value.

    Parameters

    • name: string

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

    Returns number

    An integer corresponding to the parsed variable's value.

    Throws

    An Error instance explaining that the variable was either not found or that it could not be parsed into a valid integer.

    See

    asOptionalInteger

    Note

    Internally, this function uses Number.parseInt to try to convert the string into an integer. That means, for example, that a value like "123_test" will yield "123" instead of failing. In other words, if Number.parseInt returns something other than NaN, this function won't throw.

Generated using TypeDoc