SplitParts is a class that splits a string into parts and allows for replacements. The class takes a string with replacement tokens (e.g., "%email%") and allows these tokens to be replaced with actual values. The replacement tokens in the string correspond to the keys in the replacement object.

Param: original

The original string to be split. This string can contain replacement tokens surrounded by % characters.

Constructors

Properties

Accessors

Methods

Constructors

Properties

_original: string
parts: (string | Part)[] = []
splitter: (<KeyType, ValType>(parts, key, value?) => any) = splitter

Type declaration

    • <KeyType, ValType>(parts, key, value?): any
    • Type Parameters

      • KeyType = string
      • ValType = any

      Parameters

      Returns any

Accessors

Methods

  • Replaces a key in the parts with a value. The key should correspond to a replacement token in the original string. If the key is an object and the value is undefined, the key is used as a key-value pair object for multiple replacements.

    Type Parameters

    • KeyType = string | object
    • ValType = any

    Parameters

    • key: KeyType

      The key to replace. This should correspond to a replacement token in the original string. If this is an object and value is undefined, this object is used for multiple replacements.

    • Optional value: ValType

      The value to replace the key with. If key is an object and this is undefined, key is used for multiple replacements.

    Returns SplitParts

    The instance of the SplitParts class.