Skip to content

@longmo-utils/node / hasEnv

Function: hasEnv()

ts
function hasEnv(key): boolean;

检查环境变量是否已设置

Parameters

ParameterTypeDescription
keystring环境变量键

Returns

boolean

是否已设置

Example

ts
if (hasEnv('API_KEY')) {
  console.log('API_KEY is set')
}

Released under the MIT License.