For this use case I would say that it depends on what the filterObject(obj) function is doing. If its content is strongly related to the business context you are within (API, plugin, β¦), I would recommend to expose it has part of a of service. So you can call it from anywhere using thee proper syntax.
On the other part, if the business logic of the function is not bound to your context. I would export it has a function in the config/functions directory.
I donβt know if this is the recommended way for handling this, but it works for me.