Skip to content

AngularParser

reference
1 min readUpdated

Kind: Class

Source: atloria-monorepo/libs/parser-core/src/parsers/frontend/angular.parser.ts

Angular Parser

Pure TypeScript class that parses Angular TypeScript files. No NestJS dependencies required.

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
namestring
versionstring
supportedPatternsstring[]

Where it refuses work

  • AngularParser stops the work with an early return when !name, in 4 places.
  • AngularParser stops the work with an early return when filePath.endsWith('.component.ts') || filePath.endsWith('.directive.ts') || filePath.ends….
  • AngularParser stops the work with an early return when filePath.endsWith('.service.ts') || filePath.endsWith('.module.ts') || filePath.endsWith(….
  • AngularParser stops the work with an early return when !this.canParse(filePath).
  • AngularParser stops the work with an early return when !fileContent.trim().
  • AngularParser stops the work with an early return when jsDocs.length > 0.

When something fails

  • AngularParser handles failure in 2 places: it logs it and continues in 1, and turns it into a return value in 1.

Was this page helpful?

Download as PDF