Issue #2 -- each now calls iterator with (value, key, list) when iterating over javascript objects

This commit is contained in:
Jeremy Ashkenas
2009-10-29 10:46:53 -04:00
parent 8e7b8d2dea
commit 42637b5880
3 changed files with 18 additions and 17 deletions

View File

@@ -171,10 +171,9 @@
<br />
Iterates over a <b>list</b> of elements, yielding each in turn to an <b>iterator</b>
function. The <b>iterator</b> is bound to the <b>context</b> object, if one is
passed. Each invocation of <b>iterator</b> is called with three arguments,
<i>element</i>, <i>index</i>, and the <b>list</b>.
If <b>list</b> is a JavaScript object, a pair with <b>key</b>
and <b>value</b> properties will be yielded. If the list has an <b>each</b>
passed. Each invocation of <b>iterator</b> is called with three arguments:
<tt>(element, index, list)</tt>. If <b>list</b> is a JavaScript object, <b>iterator</b>'s
arguments will be <tt>(value, key, list)</tt>. If the <b>list</b> has an <b>each</b>
method of its own, it will be used instead. Delegates to the native
<b>forEach</b> function if it exists.
</p>