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

The 'contains' helper accepts objects and some other new functionality #6

Closed
villesiltala opened this issue Sep 2, 2016 · 0 comments
Assignees

Comments

@villesiltala
Copy link

Add a functionality for the contains helper to check if an object has a specific key and/or a value.

If an object is passed as the haystack, then the helper loops through all the keys and does a loose comparison on the values by the given needle and returns true if the needle is found. The key paramater will be changed to map.

{@contains map=haystack value="needle" /}

If only the key parameter is set, then the helper checks whether the given key is set in the array/object.

{@contains map=haystack key="needle" /}

If the key and value parameters are set, then the helper checks whether the given key is set in the array/object and it loosely matches the given value.

{@contains map=haystack key="needle" value="matching_value" /}
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

No branches or pull requests

2 participants