Hello guys, I have a question!
I want a JavaScript code to be used in a “code” node of n8n, which, when inserting a text without a comma, returns itself. If the text has a comma, stop the words, and return the result with the words separated by comma and space after the comma. The last two words should be separated by “and” instead of comma. If there are only 2 words in the text, separate only by " and ".
Ex.:
Talita → Talita
Talita,John → Talita and John
Talita,John,Peter → Talita, Jonh and Peter
Could you please help me this issue?