My Custom Node

Custom node for text transformation

Overview

This node performs simple text transformations on an input string. It supports converting text to uppercase, lowercase, or reversing the text. This node is useful in scenarios where you need to normalize or manipulate text data within a workflow, such as preparing user input for consistent formatting, generating reversed strings for encoding or display purposes, or simply changing case for comparison or display.

Practical examples:

  • Converting user-submitted names or titles to uppercase for uniformity.
  • Lowercasing email addresses before validation or storage.
  • Reversing strings for creating palindromes or obfuscating text.

Properties

Name Meaning
Input Text The text string that you want to transform.

The Operation property (not listed in your provided JSON but present in the code) determines the type of transformation and can be one of:

  • To Uppercase
  • To Lowercase
  • Reverse Text

Output

The node outputs an array of items, each containing a json object with the following fields:

  • result: The transformed text after applying the selected operation.
  • inputText: The original input text provided.
  • operation: The operation performed (toUppercase, toLowercase, or reverseText).

Example output JSON structure:

{
  "result": "HELLO WORLD",
  "inputText": "Hello World",
  "operation": "toUppercase"
}

No binary data is produced by this node.

Dependencies

  • No external services or API keys are required.
  • The node relies solely on built-in JavaScript string methods.
  • No special n8n environment variables or credentials are needed.

Troubleshooting

  • Unsupported Operation Error: If an unsupported operation value is somehow passed, the node throws an error indicating the operation is not supported. Ensure the operation parameter is set correctly.
  • Empty Input Text: Providing an empty string as input will result in an empty string output without errors.
  • Continue On Fail: If enabled, the node will continue processing subsequent items even if one item causes an error, returning the error message in the output for that item.

Links and References

Discussion