-
-
Notifications
You must be signed in to change notification settings - Fork 495
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
Change filter
front matter key to filterOut
for v2.x
#2522
Comments
Maybe we could use ‘exclude’ instead of ‘filterOut’ if that’s not already taken |
I agree with @mayankkamboj47 to choose 'exclude' over 'filterOut'. Not only because it seems more semantic to me, but it also allows for the addition of an 'include' property which might filter what to include from the collection. |
@zachleat Please don’t forget this before v2.0 leaves beta! 🙏 |
I'm all for adding |
Especially @zachleat: I personally see these options: 1. Disallow 2. Exclude over Include 3. Include over Exclude I'd personally tend to use option 1, but I'm completely open to suggestions. |
Option 1 is the only one that makes sense to me, I'd go with that. |
Maybe this can squeeze in before the final release of v3? |
Ruthlessly punting this one to 4.0, sorry! |
😭 J/k. I'm good. 🙂 |
Is your feature request related to a problem? Please describe.
When writing a
.filter( … )
function in JavaScript, I tend to think of it as “Filter FOR «truthy condition»”. In other words, I think in terms of what I want to include.But the
filter
front matter key filters based on what you want to exclude.Describe the solution you'd like
For more human-friendliness, I recommend changing the name of this key to
filterOut
for the official v2.x release of Eleventy.Describe alternatives you've considered
Optionally, you could allow Eleventy to continue support for
filter
with a deprecation warning.(You could also keep the
filter
keyword, and flip the logic that Eleventy uses…but that is hostile to users that have become used to the current behavior.)The text was updated successfully, but these errors were encountered: