Skip to content

Instantly share code, notes, and snippets.

@WietseWind
Last active June 15, 2016 07:11
Show Gist options
  • Save WietseWind/96635b5f101abfa82145087a716fb91d to your computer and use it in GitHub Desktop.
Save WietseWind/96635b5f101abfa82145087a716fb91d to your computer and use it in GitHub Desktop.
nodum.io - Waarde aan array mergen
{% 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