From 6debb0f85c5d5a14bf3190d7bfc60ffbc9027003 Mon Sep 17 00:00:00 2001 From: Paul Weiss Date: Tue, 13 May 2025 13:22:30 -0400 Subject: [PATCH] added script to join lines with a comma, wrapping each line with a single quote. --- Scripts/JoinLinesWithCommaAndSingleQuote.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Scripts/JoinLinesWithCommaAndSingleQuote.js diff --git a/Scripts/JoinLinesWithCommaAndSingleQuote.js b/Scripts/JoinLinesWithCommaAndSingleQuote.js new file mode 100644 index 00000000..2bcbe41f --- /dev/null +++ b/Scripts/JoinLinesWithCommaAndSingleQuote.js @@ -0,0 +1,17 @@ +/** + { + "api":1, + "name":"Join Lines With Comma and Single Quote", + "description":"Joins all lines with a comma.", + "author":"pweiss82", + "icon":"collapse", + "tags":"join, comma, single-quote", + "bias": -0.1 + } +**/ + +function main(input) { + // Wrap each line in single quotes and join with comma + input.text = input.text.replace(/\n/g, "', '"); + input.text = "'" + input.text + "'"; +}