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

Add a 'getkey' helper #5

Closed
villesiltala opened this issue Aug 30, 2016 · 3 comments
Closed

Add a 'getkey' helper #5

villesiltala opened this issue Aug 30, 2016 · 3 comments
Assignees
Labels

Comments

@villesiltala
Copy link

Add a core helper that prints out a value from an array or an object by the passed key. The syntax could be as follows:

{@getkey map=array/object key=key /}

If the key is no set, an empty string is printed.

@Nomafin
Copy link
Contributor

Nomafin commented Sep 17, 2016

Can you elaborate a bit what do you mean with this?

@villesiltala
Copy link
Author

This enables you to dynamically get a value from an object.

Print out a string:

{my_string}

Print out a value from an object with the string as the key:

{@getkey map=my_object key=my_string /}

@villesiltala
Copy link
Author

This is against Dust philosophy. We will not implement a dynamic key getter. If you need this kind of logic, there is something wrong with you and your model structure. ;)

Not implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants