Class ContributionSurveyRowParser

Parser for ContributionSurveyRows.

This is used directly in unit tests. Do not import unnecessary dependencies, as they may indirectly import the entire Deputy codebase outside a browser environment.

Constructors

Properties

wikitext: string

Methods

  • Eats a given expression from the start of the working string. If the working string does not contain the given expression, null is returned (and not a blank string). Only eats once, so any expression must be greedy if different behavior is expected.

    The regular expression passed into this function is automatically re-wrapped with ^(?:<source>). Avoid adding these expressions on your own.

    Parameters

    • pattern: RegExp

      The pattern to match.

    • n: number = 0

      The capture group to return (returns the entire string (0) by default)

    Returns string

    The consumed characters.

  • Eats a given expression from the start of the working string. If the working string does not contain the given expression, null is returned (and not a blank string). Only eats once, so any expression must be greedy if different behavior is expected.

    The regular expression passed into this function is automatically re-wrapped with ^(?:<source>). Avoid adding these expressions on your own.

    Parameters

    • pattern: RegExp

      The pattern to match.

    Returns RegExpExecArray

    A RegExpExecArray.

  • Continue eating from the string until a string or regular expression is matched. Unlike eatExpression, passed regular expressions will not be re-wrapped with ^(?:). These must be added on your own if you wish to match the start of the string.

    Parameters

    • pattern: string | RegExp

      The string or regular expression to match.

    • OptionalnoFinish: boolean

      If set to true, null will be returned instead if the pattern is never matched. The working string will be reset to its original state if this occurs. This prevents the function from being too greedy.

    Returns string

    The consumed characters.