Open ilyapuchka opened 6 years ago
@AliSoftware this is filter, you have node in StencilSwiftKit as far as I can see.
@kylef I've solved conflicts so this is ready for review. I also added filter
filter that allows using filters and boolean expressions, i.e. items|filter:"$0|isPositive"
or items|filter:"$0 > 0"
, and refactored a bit parsing of expressions so that it matches API for parsing filters
@kylef I've made some changes here converting filter
to filterEach
and changing behaviour of filter
. Now it will resolve it's argument as filter expression which will allow to apply dynamic filters. The use case for that can be using Sourcery to generated code for Codable
and use different key coding strategies applied for different data models. It will allow to specify strategy as a filter in type annotation, i.e. uppercaseFirstLetter
or camelCaseToSnakeCase
. Currently in template I have to check annotations against hardcoded set of filters to be able to apply them.
If you want I can break it out in a separate PR as it is not related to other array filters added here.
Extracted filter
functionality to #203
This now only contains filters for mapping and filtering arrays.
Can we merge this @kylef ?
Do you have any news on this?
Curious about the status on this @ilyapuchka. Would love to see this make it in! Thanks
Hi all, wanted to bump this to see if there was any chance of merging in or updating this PR to get it back to a mergeable state. Happy to help — thanks!
Isn't that a duplicate from the
map
we have in StencilSwiftKit? I'm all for bringing our generic filters like this one in Stencil proper, but be sure they won't interfere and maybe keep the syntax we used if it's indeed the same idea?(Disclaimer: I'm on vacation and only skimming thru the issues from my phone so didn't read this in details)