this post was submitted on 19 Feb 2025
0 points (NaN% liked)
ActivityPub
0 readers
2 users here now
Focused discussion related to ActivityPub integration in NodeBB
This is a forum category containing topical discussion. You can start new discussions by mentioning this category.
founded 2 months ago
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
In a bit of code that is too clever for my own good, I collapse
to
andcc
into a single deduplicated array with:const recipients = new Set([...object.to, ...object.cc]);
Which of course assumes that both properties are iterable. That has now been changed to an even clever-er (and less readable):
const recipients = new Set([...(object.to || []), ...(object.cc || [])]);
:sunglasses:
@julian Wouldn't
??
be better?@rikudou maybe? Nullish coalescing sounds really cool, but I've avoided it for years because of browser compatibility.
Node has had support forever (since v14, I've discovered), but I just don't know how to use it is all :smile: