Add @value to context when iterating over maps/iterables#540
Add @value to context when iterating over maps/iterables#540giflw wants to merge 2 commits intojknack:masterfrom
Conversation
Add @value to context to more semantic the access to map key/value pairs
|
Hello @giflw thanks for your pull. Is this supported by handlebarsjs? If so, then can you please add a two test: one with list input the other with a hash/map input. |
|
Hi @jknack . I have no idea if this is supported on JS. I was just using the Java version now, and seems to me that it would be semantically better than using {{this}} to access the value of the map entry. |
|
Yea, just tried at http://tryhandlebarsjs.com/ and isn't supported by handlebars.js This creates incompatibilities between the two implementations so don't think is a good idea to add this for now. That's being said, let's keep this pull open and if more users find it valuable then I will merge. Thanks again. |
|
Maybe this change can be made in JS version too. I just need to have a little more time to do that. I think this is the file that need to be modified: https://github.com/wycats/handlebars.js/blob/e8ceafa6525a5d41a20aa74dfe24bf99d0bc2fcd/lib/handlebars/helpers/each.js. This way, there will be no incompatibilities. |
|
That will be ideal, yes! |
|
I made a proposal there handlebars-lang/handlebars.js#1253. |
|
Rejected as explained in related handlebars.js issue |
Add @value to context to more semantic the access to map key/value pairs