It looks like you are using a Function Item-Node when you should be using a Function-Node instead. You can find the documentation about it here which describes the difference and how both work:
Here an example of how what you are trying to do is possible with the IF-Node and the Function-Node:
(you can simply copy&paste it directly into n8n, it will then create all nodes and connections)
You should probably check again the documentation about the Function-Node which I did post earlier. That one also links to a page about the internal data structure used which is important when the Function-Node does get used. That documentation can be found here:
To use the Function-Node it is very important to understand how the data which flows through the workflow looks exactly.
What was missing is that the JSON-data of each item is saved in a property named “json”. So the data has to get read from it and also does the data have to get returned in it. Hope that makes sense.