Options
All
  • Public
  • Public/Protected
  • All
Menu

Represents a successful match. Contains microgrammar information in fields with names beginning with $ and any user-defined fields. To ensure this separation works cleanly, not bind user data to fields beginning with $.

Hierarchy

Index

Constructors

Properties

Methods

Constructors

constructor

  • new PatternMatch($matcherId: string, $matched: string, $offset: number): PatternMatch
  • Represents a match

    Parameters

    • $matcherId: string

      id of the matcher that matched

    • $matched: string

      the actual string content

    • $offset: number

      offset from 0 in input

    Returns PatternMatch

Properties

$matched

$matched: string

the actual string content

$matcherId

$matcherId: string

id of the matcher that matched

$offset

$offset: number

offset from 0 in input

Abstract $value

$value: any

Value extracted from matcher.

returns

the $value that is extracted from this matcher. May be a scalar or an array, or a nested structure. May or not be the same as $matched property.

Methods

matchedStructure

  • matchedStructure<T>(): T
  • Return just the structure that was matched, throwing away offset and matcher information. This is useful if you want to store PatternMatches after you're done with their internal information.

    Type parameters

    • T

    Returns T

Generated using TypeDoc