prefixSuffix

This tag splits the input into pieces using new lines and then joins them with each element getting a prefix and suffix.

Created by: hackvertor
Installed 1 times

Viewed: 0

Category: String

Created on: Thursday, September 4, 2025 at 12:34:46 PM

Updated on: Thursday, September 4, 2025 at 12:34:46 PM

This is a built in tag
Tag arguments
[
   {
      "type": "string",
      "help": "This is the prefix to add to each piece",
      "defaultValue": "&"
   },
   {
      "type": "string",
      "help": "This is the suffix to add to each piece",
      "defaultValue": ";"
   }
]
Code
class prefixSuffix {
  encode(input, prefix, suffix) {
    return input
      .split("\n")
      .map((element) => prefix + element + suffix)
      .join("\n");
  }
}