mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-15 11:56:50 +00:00
Rename variables used in map method
This commit is contained in:
committed by
Fabien Potencier
parent
e8068a9a6d
commit
b74cf2ae6c
+1
-1
@@ -27,7 +27,7 @@ The arrow function also receives the key as a second argument:
|
|||||||
"Alice": "Dupond",
|
"Alice": "Dupond",
|
||||||
} %}
|
} %}
|
||||||
|
|
||||||
{{ people|map((last, first) => "#{first} #{last}")|join(', ') }}
|
{{ people|map((value, key) => "#{value} #{key}")|join(', ') }}
|
||||||
{# outputs Bob Smith, Alice Dupond #}
|
{# outputs Bob Smith, Alice Dupond #}
|
||||||
|
|
||||||
Note that the arrow function has access to the current context.
|
Note that the arrow function has access to the current context.
|
||||||
|
|||||||
Reference in New Issue
Block a user