Skip to content

EnvParser

reference
1 min readUpdated

Kind: Class

Source: atloria-monorepo/libs/parser-core/src/parsers/config-docs/env.parser.ts

Environment Variable Parser implementation

Implements: IParser

Methods

MethodSignatureReturns
initializeinitialize(_config: ParserConfig)Promise<void>
canParsecanParse(filePath: string)boolean
parseFileparseFile(filePath: string, content: string)Promise<ParseResult>
parseFilesparseFiles(files: ParseFileInput[])Promise<ParseResult[]>
destroydestroy()Promise<void>

Properties

PropertyType
nameany
versionany
supportedPatternsany

Where it refuses work

  • EnvParser stops the work with an early return when isExample && this.isPlaceholderValue(envVar.value).
  • EnvParser stops the work with an early return when !envVar.value || envVar.value.trim() === ''.
  • EnvParser stops the work with an early return when !value || value.trim() === ''.
  • EnvParser stops the work with an early return when trimmed === 'true' || trimmed === 'false'.
  • EnvParser stops the work with an early return when /^-?\d+$/.test(trimmed).
  • EnvParser stops the work with an early return when /^-?\d*\.\d+$/.test(trimmed).

When something fails

  • EnvParser handles failure in 1 place: it turns it into a return value in all 1.

Was this page helpful?

Download as PDF