Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added map, compact and filter array filters #189

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

ilyapuchka
Copy link
Collaborator

No description provided.

Sources/Filters.swift Outdated Show resolved Hide resolved
@kylef kylef added this to the 0.11.0 milestone Jan 22, 2018
@AliSoftware
Copy link
Collaborator

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)

@ilyapuchka
Copy link
Collaborator Author

@AliSoftware this is filter, you have node in StencilSwiftKit as far as I can see.

@ilyapuchka
Copy link
Collaborator Author

@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

@ilyapuchka ilyapuchka changed the title Added map and compact filters Added map, compact and filter filters Mar 2, 2018
@ilyapuchka ilyapuchka changed the title Added map, compact and filter filters Added map, compact and filter array filters Mar 2, 2018
@ilyapuchka
Copy link
Collaborator Author

@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.

@ilyapuchka
Copy link
Collaborator Author

Extracted filter functionality to #203
This now only contains filters for mapping and filtering arrays.
Can we merge this @kylef ?

@djbe djbe modified the milestones: 0.11.0, 1.0.0 Jul 11, 2018
@ilyapuchka ilyapuchka modified the milestones: 1.0.0, 0.12.0 Aug 18, 2018
@ilyapuchka ilyapuchka requested a review from djbe August 18, 2018 20:26
CHANGELOG.md Outdated Show resolved Hide resolved
Sources/Extension.swift Outdated Show resolved Hide resolved
Sources/Extension.swift Outdated Show resolved Hide resolved
@djbe djbe modified the milestones: 0.12.0, 0.13.0, 0.14.0 Sep 21, 2018
@IvanUshakov
Copy link

Do you have any news on this?

# Conflicts:
#	Sources/Extension.swift
#	Sources/Filters.swift
#	Sources/ForTag.swift
#	Sources/IfTag.swift
#	Sources/Parser.swift
#	Sources/Variable.swift
#	Tests/StencilTests/ExpressionSpec.swift
#	Tests/StencilTests/FilterSpec.swift
#	Tests/StencilTests/ForNodeSpec.swift
#	Tests/StencilTests/VariableSpec.swift
@ilyapuchka ilyapuchka requested a review from djbe December 8, 2019 14:14
@opfeffer
Copy link

opfeffer commented May 1, 2020

Curious about the status on this @ilyapuchka. Would love to see this make it in! Thanks

@djbe djbe modified the milestones: 0.14.0, 0.15.0 Aug 17, 2020
@namolnad
Copy link

namolnad commented Apr 8, 2022

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!

@djbe djbe removed this from the 0.15.0 milestone Jul 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants