Skip to content

Commit

Permalink
minor twigphp#3628 Rename variables used in map method (alexander-sch…
Browse files Browse the repository at this point in the history
…ranz)

This PR was submitted for the 3.x branch but it was merged into the 2.x branch instead.

Discussion
----------

Rename variables used in map method

As most people (including me) are lazy people to read text and mostly looks just at the code. Using `key` and `value` as variable make the map faster to understand which argument is which one :)

Commits
-------

b74cf2a Rename variables used in map method
  • Loading branch information
fabpot committed Jan 14, 2022
2 parents e8068a9 + b74cf2a commit 9984a6e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion doc/filters/map.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ The arrow function also receives the key as a second argument:
"Alice": "Dupond",
} %}
{{ people|map((last, first) => "#{first} #{last}")|join(', ') }}
{{ people|map((value, key) => "#{value} #{key}")|join(', ') }}
{# outputs Bob Smith, Alice Dupond #}
Note that the arrow function has access to the current context.
Expand Down

0 comments on commit 9984a6e

Please sign in to comment.