New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

@comment-labs/assert-env

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@comment-labs/assert-env

Type-safe environment variable validation

npmnpm
Version
1.0.0-beta.4
Version published
Weekly downloads
43
-28.33%
Maintainers
1
Weekly downloads
 
Created
Source

@comment-labs/assert-env

Type-safe environment variable validation.

Installation

pnpm add @comment-labs/assert-env

Usage

import { assertEnv } from '@comment-labs/assert-env'

const env = assertEnv(
  {
    ACCOUNT_ID: 'string',
    PORT: 'number'
  },
  {
    optional: {
      DEBUG: 'boolean'
    }
  }
)

env.ACCOUNT_ID
env.PORT
env.DEBUG

Supported Types

  • string
  • number
  • boolean

Validation Behavior

  • Required variables must be set.
  • string values must not be empty or whitespace-only.
  • number values are trimmed before parsing and support floats and negative numbers.
  • boolean values accept true, false, 1, 0, yes, and no, case-insensitively.
  • Optional variables are omitted when missing or blank.
  • Invalid variables are reported together in a single error.

License

Apache-2.0

FAQs

Package last updated on 24 May 2026

Related posts