Filtering the issues returned from links as SET Follow
Hi,
I am wondering, is there any way how to filter the issues returned from the links as a Set. As there is no filter method on the Set object, I have tried to filter it using the forEach method and adding items that conform the condition to the new Set.
function filterSet(set, condition) {
var newSet = new Set();
var iterator = set.entries();
var iteration = iterator.next();
while(!iteration.done) {
if(condition(iteration.value)) {
newSet.add(iteration.value);
}
iteration = iterator.next();
}
return newSet;
}
The problem is, calling new Set(); creates an error ReferenceError: "Set" is not defined.
My question is, is there a way to create a new Set object? If not, what is the best way to filter the Set object?
Please sign in to leave a comment.
Hello,
I believe that the search method should fit your scenario. If you have any further questions, feel free to contact us.
Hello Oleg,
thank you for your suggestion, I was able to solve my problem using the search method. However, for my curiosity, is there a way to create a new Set object?
Thank you for your answer.
Lukas
Hello,
I am afraid, YouTrack workflow does not allow creating your own Sets. The Set object used in the workflow is different from a standard JavaScript Set.