vuestorefront / storefront-query-builder

ElasticSearch Query builder from the abstract "SearchQuery" object used by storefront-api, vue-storefront-api and vue-storefront projects
MIT License
7 stars 21 forks source link

Add the current class scope to custom mutator functions #20

Open cewald opened 3 years ago

cewald commented 3 years ago

This way you could use the default RequestBody class scope to e.g. use extractFirstValueMutator in a custom-filter's value mutator without duplicating it or use other magic based on the current RequestBody class instance.

For example: If I'd like to use the default extractFirstValueMutator in a custom filter I currently need to duplicate this functionality. With the scope added to the message using call we can just write smth like:

mutator () { return this.extractFirstValueMutator(value) }