Creates the instance of DotEnvCaster.
Casts a bigint | undefined constant to a bigint.
The constant to be cast.
Casts a boolean | undefined constant to a boolean.
The constant to be cast.
import * as dotenv from 'dotenv';
// Import dotenv-caster
import { DotEnvCaster } from 'dotenv-caster';
dotenv.config();
// Create an instance
const dotenvCaster = new DotEnvCaster();
// string | undefined -> boolean
const booleanSample: boolean = dotenvCaster.castBoolean(process.env.BOOLEAN_SAMPLE);
Casts a null | undefined constant to a null.
The constant to be cast.
Casts a number | undefined constant to a number.
The constant to be cast.
Casts a string | undefined constant to a string.
The constant to be cast.
Casts a symbol | undefined constant to a symbol.
The constant to be cast.
The DotEnvCaster class is a utility for casting environment variables to specific types.
Author
Yuki Osada r.rstudio.c@gmail.com