Transformer on stripe field

I am trying to filter down a response from Stripe so that I can search a given parameter. However, no matter how I seem to form the code it always seems to return null.

return data.filter(f => f.statement_descriptor.toLowerCase().indexOf(textInput1.value.toLowerCase()) !== -1 )

This for example is saying data.filter is not a function
return data.filter(f => f.currency === "eur")

Any pointers would be great...

I rely in Chrome debug tools in situations like this.

First in order to set a breakpoint you need to expand your arrow function and add a debugger command like this:

return data.filter(function (f) {
f.statement_descriptor.toLowerCase().indexOf(textInput1.value.toLowerCase()) !== -1 

If you have the transformer in the query itself, take it out and put it into its own transformer.

Run the query.

F12 into Dev tools and then run the transformer. When the the code breaks at debugger, set a new breakpoint in your filter function. Run till you hit it and now you can then see what exactly you are getting back and play around until you have the right syntax on your filter.

That's definitely one route, I'm just surprised that there are no working examples that I can find of a transformer on an resource like Stripe.

Here's one so that the next person has some clues...

return data["data"].filter(f => f.statement_descriptor === "Demo")