UNPKG

segment-matcher

Version:

Segment Matcher - TypeScript version with dual ESM/CJS format support

29 lines (28 loc) 681 B
export interface MessageSegment { type: string; data: Record<string, any>; } export type TokenType = 'literal' | 'typed_literal' | 'parameter' | 'rest_parameter'; export interface PatternToken { type: TokenType; value?: string; segmentType?: string; name?: string; dataType?: string | null; optional?: boolean; defaultValue?: any; } export interface MatchResult { matched: MessageSegment[]; params: Record<string, any>; remaining: MessageSegment[]; } export interface MatchResponse { success: boolean; matched?: MessageSegment[]; param?: { name: string; value: any; }; newSegmentIndex?: number; }