Skip to content

NestjsParser

reference
1 min readUpdated

Kind: Class

Source: atloria-monorepo/libs/parser-core/src/parsers/backend/nestjs.parser.ts

NestJS 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

  • NestjsParser stops the work with an early return when !ts.isCallExpression(decorator.expression), in 2 places.
  • NestjsParser stops the work with an early return when !/\.(controller|service|module|guard|interceptor|pipe|middleware|gateway|resolver)\.ts$/.….
  • NestjsParser stops the work with an early return when /\.(controller|guard|interceptor|middleware|gateway|resolver)\.ts$/.test(filePath).
  • NestjsParser stops the work with an early return when !fileContent.trim().
  • NestjsParser stops the work with an early return when !httpMethod.
  • NestjsParser stops the work with an early return when args.length === 0 || !ts.isObjectLiteralExpression(args[0]).

When something fails

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

Was this page helpful?

Download as PDF