That’s not exactly what I meant, and perhaps I explained the issue not clear enough.
Let me try to explain it in another way, in the hopes it gets more clear:
I provide the following two variables to the transformer:
$list: A static list of key-values, describing the colors for each type of fruit (see the example in original post)
$fruit: A string which defines the type of fruit I supply to it. Sometimes, it contains apple, other times pear, etc…
Now, I want the transformer to find the color of the provided fruit from the list, and store it in a variable (for example: fruitColor in your example).
So if I supply it apple, it should return red. If I supply pear it returns green, etc etc. If I supply pineapple, which is not found in the list, it should return null.