Skip to content
Snippets Groups Projects
Commit db90cf72 authored by Robin Leber's avatar Robin Leber
Browse files

ADD: pipes in camelCase

parent 9ff9f5b8
No related branches found
No related tags found
No related merge requests found
......@@ -103,14 +103,24 @@ export const handlePipeBinding = (pipeMapping, editor) => {
const makeValidConstName = (str) => {
// Entferne nicht erlaubte Zeichen, nur Buchstaben, Zahlen, _ und $ sind erlaubt
let validStr = str.replace(/[^a-zA-Z0-9_$]/g, "");
let validStr = str.replace(/[^a-zA-Z0-9_$ ]/g, ""); // Behalte Leerzeichen für CamelCase
// Konvertiere zu CamelCase
validStr = validStr
.split(" ")
.map((word, index) =>
index === 0
? word.toLowerCase()
: word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()
)
.join("");
// Stelle sicher, dass der Name nicht mit einer Zahl beginnt
if (/^[0-9]/.test(validStr)) {
validStr = "_" + validStr;
}
// Überprüfen und anpassen, falls der Name ein reserviertes Wort ist (einfaches Beispiel)
// Überprüfen und anpassen, falls der Name ein reserviertes Wort ist
const reservedWords = new Set([
"var",
"let",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment