Tawaliou ALAO
Software Developer
Thanks for sharing the complete solutions!
There are functional alternatives to forEach, for and other array operations.
For example, this code:
let itemsAsList: string[] = [];
itemsAsSet.forEach((v) => {
if (v !== undefined && v !== null) itemsAsList.push(v);
});
return itemsAsList;
can be written as:
let itemsAsList = itemsAsSet.filter((v) =>
v !== undefined && v !== null
));
return itemsAsList;
Ákos Kőműves Yes yes but, itemsAsSet is a Set and has not filter as method. But we can write this:
let itemsAsList = Array.from(itemsAsSet).filter((v) => v !== undefined && v !== null ));Thank you for the feedback, I appreciate it and I'll integrate the correction