• 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 a float value, 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

    A float 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 float.

    See

    asOptionalFloat

    Note

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

Generated using TypeDoc