typescript

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 27, 2026 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package typescript provides centralized TypeScript patterns for semantic analysis

Index

Constants

This section is empty.

Variables

View Source
var (
	// ThisPropertyAssignPattern matches this.property = ...
	// Used to detect constructor parameter flow to properties
	ThisPropertyAssignPattern = regexp.MustCompile(`this\.(\w+)\s*=`)

	// BracketKeyAccessPattern matches ['key'], ["key"], or [`key`] (template literal)
	// Used to extract keys from bracket notation including template literals
	BracketKeyAccessPattern = regexp.MustCompile(`\[['"\x60](\w+)['"\x60]\]`)

	// RequestPropertyChainPattern matches .body.prop, .query.prop, .params.prop, etc.
	// Used to extract nested property access on request objects
	RequestPropertyChainPattern = regexp.MustCompile(`\.(body|query|params|headers|cookies)\.(\w+)`)

	// DecoratorPatternPrefix is the prefix for TypeScript/NestJS decorators
	DecoratorPatternPrefix = `@`
)

Functions

func BuildDecoratorPattern

func BuildDecoratorPattern(decoratorPattern string) *regexp.Regexp

BuildDecoratorPattern creates a pattern for @decoratorName(

func BuildPropertyPattern

func BuildPropertyPattern(pattern string) *regexp.Regexp

BuildPropertyPattern creates a pattern for .propertyName with word boundary

func BuildThisPropertyAssignPattern

func BuildThisPropertyAssignPattern(paramName string) *regexp.Regexp

BuildThisPropertyAssignPattern creates a pattern for this.property = ... paramName

func ExtractBracketKey

func ExtractBracketKey(expr string) string

ExtractBracketKey extracts the key from bracket notation ['key'], ["key"], or [`key`]

func ExtractRequestChainProperty

func ExtractRequestChainProperty(expr string) (string, string)

ExtractRequestChainProperty extracts the property from request.body.prop style access Returns (category, property) e.g., ("body", "userId")

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL