Open maccman opened 13 years ago
It seems nice, but I kind of like restricting the template context to an object. Not a strong opinion though.
@sstephenson worth me refactoring the array check? Is this something you'd like to see in core?
@josh - the template context will still be an object, the array index.
+1. I ended up writing myself a helper function to template an array at first (this is what i was used to from other libraries). Since then i've been been doing <% for item, i in @: %>
because it gives me access to the iterator in the template (which is desired IMO). Would for sure want access to the iterator if the library decided to take this one on. I suppose this is more of a connivence and an necessity. Is the recommended behavior to do as i have been with <% for item, i in @: %>
?
Not sure if you want this in core, but it lets you pass an array to eco(), instead of an object, rendering the template over each item in the array. This is the standard in other templating libs, like jQuery.tmpl.