Describe the issue/error/question
I was trying to use Javascript’s Set in a Function node, but I get an empty object when logging the set to console. Is this not possible or am I missing sth?
Please share the workflow
Information on your n8n setup
-
n8n version: 0.193.5
-
Database you’re using (default: SQLite): Postgres
-
Running n8n with the execution process [own(default), main]: main
-
Running n8n via [Docker, npm, n8n.cloud, desktop app]: Docker
1 Like
Funny cause I was able to use the following no problem:
let years = [2012, 2012, 2015]
const uniqueYears = [...new Set(years)];
console.log(uniqueYears); // --> [2012, 2015]
Same issue here. Still not resolved, apparently.
Hi @einfachiso
I have used it and the topic seems solved. So if you have an issue with it please start a new topic with more details and a snippet of your code that isnt working.
Thanks @BramKn.
Opened a new topic here: Using standard javascript Set in code node not working
To clarify - the workaround posted by @leprodude works for me as well but creating a new Set instance and working with that does not.
Hi @einfachiso
@ihortom Gave you the right answer over at that topic.
You cannot simply return a set as it is not valid JSON.
To keep things clean and in one place Ill close this topic.