vapor / template-kit

📄 Easy-to-use foundation for building powerful templating languages in Swift.
MIT License
46 stars 17 forks source link

Add containsKey tag #58

Open jdanthinne opened 5 years ago

jdanthinne commented 5 years ago

When building forms (this is an example of the use of this tag, there can be many other), I usually tend to build a dictionary of validation errors as ["name_of_the_field": "This is the validation error to show"]. With this tag, when looping over my fields, I could just test if the dictionary contains a validation error for a given field with #if(containsKey(validationErrors, "name_of_the_field")) and then display the error if needed.