@01/env 中文文档教程
env
Nodejs 环境工具
env
const nodeEnv:string = env("NODE_ENV", "development")
// process.env.NODE_ENV or "development"
envInt
const timeout:number = envInt("TIMEOUT", 5000)
// process.env.TIMEOUT as int or 5000
envFloat
const scaleFactor:number = envFloat("SCALE_FACTOR", 2.56)
// process.env.SCALE_FACTOR as float or 2.56
envBoolean
const isEnabled:boolean = envBoolean("IS_ENABLED", false)
// process.env.IS_ENABLED as boolean or false
env
Nodejs env utils
env
const nodeEnv:string = env("NODE_ENV", "development")
// process.env.NODE_ENV or "development"
envInt
const timeout:number = envInt("TIMEOUT", 5000)
// process.env.TIMEOUT as int or 5000
envFloat
const scaleFactor:number = envFloat("SCALE_FACTOR", 2.56)
// process.env.SCALE_FACTOR as float or 2.56
envBoolean
const isEnabled:boolean = envBoolean("IS_ENABLED", false)
// process.env.IS_ENABLED as boolean or false
更多