Route pattern class.

Hierarchy

  • Pattern

Constructors

  • Parameters

    • Optional path: string
    • options: {
          constraints?: PlaceholderTypes;
          defaults?: Record<string, any>;
          types?: PlaceholderTypes;
      } = {}
      • Optional constraints?: PlaceholderTypes
      • Optional defaults?: Record<string, any>
      • Optional types?: PlaceholderTypes

    Returns Pattern

Properties

_ast: ASTNode[] = []
constraints: PlaceholderTypes

Pattern constraints.

defaults: Record<string, any>

Pattern default values.

placeholders: string[] = []

Placeholder names.

regex: undefined | RegExp = undefined

Pattern in compiled regular expression form.

types: PlaceholderTypes

Placeholder types.

unparsed: string = ''

Raw unparsed pattern.

Methods

  • Parameters

    • withExtension: boolean

    Returns RegExp

  • Parameters

    Returns string

  • Parameters

    Returns string

  • Returns void

  • Match pattern against entire path.

    Parameters

    • path: string
    • options: MatchOptions

    Returns null | Record<string, any>

  • Match pattern against path and return the remainder.

    Parameters

    • path: string
    • options: MatchOptions

    Returns null | Record<string, any> & {
        remainder: string;
    }

  • Parse pattern.

    Parameters

    • path: string = ''

    Returns Pattern

  • Render pattern into a path with parameters.

    Parameters

    • values: Record<string, string>
    • options: MatchOptions

    Returns string

Generated using TypeDoc