Last active
June 15, 2016 07:11
-
-
Save WietseWind/96635b5f101abfa82145087a716fb91d to your computer and use it in GitHub Desktop.
nodum.io - Waarde aan array mergen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% set data = [ | |
{ naam : "Wietse", leeftijd: 12 }, | |
{ naam : "Tosca", leeftijd: 23 }, | |
{ naam : "Trinko", leeftijd: 28 }, | |
{ naam : "Wietse", leeftijd: 5 } | |
] %} | |
{% set newdata = [] %} | |
{% for d in data %} | |
{% set newdata = newdata|merge([ d|merge({ 'lt' : (d.leeftijd > 15 ? 'oud' : "jong") }) ]) %} | |
{% endfor %} | |
{{ newdata|table }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment