linkedin/dustjs — pull request #113 by rragan (2012-08-15 16:57:32+00:00)
Title: Make $idx/$len work for all array  objects and not leave old values in contexts

Currently $idx/$len are set in the push method which is called by a number of places other than sections doing iterations. This results in $idx:undefined values getting created. Also $idx/$len are not propertly set when the section is an array of simple types (e.g. [1,2,3] versus an array of objects where it works OK.

This change moves the $idx/$len setting to the section method confining the creation of these values to just iteration sections. The old way also left $idx/$len values littering the context area (try a contextDump and look). This change removes them after the iteration completes.

Added two tests for $idx/$len on array of simple types. No external doc changes needed as I don't think the limitation of only working for arrays of objects was documented. It will just work on more things now and not surprise the user.