Using map function to remove something from an array

I have an array that looks like this

Bundle 1:

  • id: 12345
  • title: blue

Bundle 2:

  • id: 6789
  • title: red

Bundle 3:

  • id: 6666
  • title: green

I want to use the Map function so it’s just an array of ids, but I want to exclude the one with title “red”. The id will be different each time, but the title stays the same.

Is there an easy way to do this, like using the filtering of the map function but with a NOT or some sort?

1 Like

I solved my own problem by putting a filter before the array aggregator that creates my array.

I’m still curious if it’s possible to put some kind of NOT operator in the map function though.

1 Like

Hey @CarlaK awesome to hear that you managed to find the solution on your own! And thanks a lot for sharing what you found out with the community so that others can learn from you in the future :pray:

1 Like

It is not possible due to the limited scope of the map() function. The original JavaScript implementation of map() could provide a custom call back function but Make doesn’t support that at all.

Even supporting the filter() method would help but alas it’s not meant to be. Your filter approach is best for now.

2 Likes