Closed ASafaeirad closed 9 months ago
export function toDecimal(s: Nullable<string>, fallback: number = NaN): number {}
To parse environment variables, we must use the following pattern.
port: toDecimal(process.env.PORT ?? "3000", 3000),
If the toDecimal function supports nullable values as input, we can write the code simply like this.
toDecimal
port: toDecimal(process.env.PORT, 3000),
Function Signature
Motivation
To parse environment variables, we must use the following pattern.
If the
toDecimal
function supports nullable values as input, we can write the code simply like this.