Skip to content

EnvParser

reference
1 min readUpdated

Kind: Class

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

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 Error when !content — “Content is required for parsing”.
  • 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 trimmed === '1' || trimmed === '0'.

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