Ivandt logo

Text transformers

Transformers for text manipulation

trimWhitespace

Removes leading and trailing whitespace from text values. Only affects string values; other types are left unchanged.

Payload: None required

{
  key: 'name',
  label: 'Customer name',
  type: 'text',
  transformers: [
    {
      action: 'trimWhitespace'
    }
  ]
}

Example:

  • Input: " John Doe "
  • Output: "John Doe"

toUpperCase

Converts text to uppercase. Only affects string values; other types are left unchanged.

Payload: None required

{
  key: 'country_code',
  label: 'Country code',
  type: 'text',
  transformers: [
    {
      action: 'toUpperCase'
    }
  ]
}

Example:

  • Input: "us"
  • Output: "US"

toLowerCase

Converts text to lowercase. Only affects string values; other types are left unchanged.

Payload: None required

{
  key: 'email',
  label: 'Email',
  type: 'text',
  transformers: [
    {
      action: 'toLowerCase'
    }
  ]
}

Example:

  • Input: "JOHN@EXAMPLE.COM"
  • Output: "john@example.com"

titleCaseText

Converts text to title case by capitalizing the first letter of words. Only affects string values; other types are left unchanged.

Payload:

PropertyTypeRequiredDefaultDescription
allWordsbooleanNofalseWhether to capitalize all words or just the first word
{
  key: 'full_name',
  label: 'Full name',
  type: 'text',
  transformers: [
    {
      action: 'titleCaseText',
      payload: {
        allWords: true
      }
    }
  ]
}

Examples:

  • Input: "hello world" with allWords: true

  • Output: "Hello World"

  • Input: "hello world" with allWords: false

  • Output: "Hello world"


padString

Pads strings to a specified length with a character. Only affects string values. If the string is already longer than the target length, it's left unchanged.

Payload:

PropertyTypeRequiredDescription
lengthnumberYesTarget length for the padded string
charstringYesCharacter(s) to use for padding
position'start' | 'end'YesWhere to add the padding
{
  key: 'product_code',
  label: 'Product code',
  type: 'text',
  transformers: [
    {
      action: 'padString',
      payload: {
        length: 5,
        char: '0',
        position: 'start'
      }
    }
  ]
}

Example:

  • Input: "42"
  • Output: "00042"

truncateText

Truncates text to a maximum length. Only affects string values longer than maxLength. Adds a suffix when truncated.

Payload:

PropertyTypeRequiredDefaultDescription
maxLengthnumberYes-Maximum length before truncation
suffixstringNo'…'Text to append when truncated
{
  key: 'description',
  label: 'Description',
  type: 'text',
  transformers: [
    {
      action: 'truncateText',
      payload: {
        maxLength: 10,
        suffix: '...'
      }
    }
  ]
}

Example:

  • Input: "Hello World!"
  • Output: "Hello Worl..."

stripHtmlTags

Removes HTML tags from text values. Strips all HTML/XML tags using regex. Only affects string values.

Payload: None required

{
  key: 'content',
  label: 'Content',
  type: 'text',
  transformers: [
    {
      action: 'stripHtmlTags'
    }
  ]
}

Example:

  • Input: "<p>Hello <strong>World</strong></p>"
  • Output: "Hello World"

regexReplace

Replaces text matching a regular expression pattern. Only affects string values. Uses JavaScript RegExp for pattern matching.

Payload:

PropertyTypeRequiredDescription
patternstringYesRegular expression pattern to match
flagsstringNoRegExp flags (e.g., 'g' for global, 'i' for case-insensitive)
replaceWithstringYesReplacement string
{
  key: 'phone',
  label: 'Phone',
  type: 'text',
  transformers: [
    {
      action: 'regexReplace',
      payload: {
        pattern: '\\d+',
        flags: 'g',
        replaceWith: 'X'
      }
    }
  ]
}

Example:

  • Input: "abc123def456"
  • Output: "abcXdefX"