Skip to main content

TextSubstitute

Callable

  • TextSubstitute<T>(textTag: string, replacers: Record<string, T>, options?: { textCache: TextCache }): (string | T)[]

  • Finds the text value linked to the tag in the buffer, partition the text value into separate parts using the given replacer keys, and then substitute them with replacer values


    Type parameters

    • T

    Parameters

    • textTag: string

      Tag for the text to find

    • replacers: Record<string, T>

      An object mapping replacement terms to values. Note that Node elements are cloned prior to the replacement

    • optionaloptions: { textCache: TextCache }

    Returns (string | T)[]

    The text associated to the tag, split into a list according to the passed replacers. Missing tag texts will be interpreted as empty strings.