Class StrongPatternParserBase<TDataType, TOptions>Abstract

Abstract base class for checking for patterns in the text using a regular expression. That expression will be used in the supports() function to immediately reject text that it does not support.

Type Parameters

Hierarchy (view full)

Constructors

Accessors

Methods

  • If the user needs to abandon this instance, they should use this to clean up active resources (like timers) and to release memory that would stall the garbage collector from disposing this object. It should assign any object reference to undefined as a strong indicator that the object has been disposed.

    Returns void

  • Since there can be several parsers for a single lookupKey and cultureID that are selected based on the text, this function is used when you want all possible candidates. It is effectively supports() without the text.

    Parameters

    • dataTypeLookupKey: string
    • cultureId: string

    Returns boolean

  • Changes the text if needed before parsing. Usually removes unwanted characters like trimming whitespace, but it could try to fix the data to closely resemble the desired text pattern that will be parsed by parseCleanedText. When it comes to strings as the native data type, it can rework the text to be the pattern expected for storage. For example, you might store a US phone number in this pattern: [3 digits]-[3 digits]-[4 digits]. The user may enter it in another familiar pattern like "(413) 555-0521" or "413 555 0520". This would clean it up to the desired pattern of "413-555-0521".

    Parameters

    • text: string
    • dataTypeLookupKey: string
    • cultureId: string

    Returns string

  • In addition to matching by dataTypeLookupKey, it also requires the text to match a regular expression. The expression reflects the one or very few patterns that parse() expects to work with. By the time parse() is called, it knows the expression has the pattern and can simply work within the regexp results.

    Parameters

    • dataTypeLookupKey: string
    • cultureId: string
    • text: string

    Returns boolean

  • Determines if we take ownership of this text. It may ultimately be rejected by the parser. For example, we want to handle all numbers even if the user has entered more than one decimal

    Parameters

    • dataTypeLookupKey: string
    • cultureId: string
    • text: string

    Returns boolean

Generated using TypeDoc v0.25.12