Skip to content

Commit 8a0cd1e

Browse files
committed
fix index value not being passed to Hash.each's iterator function
1 parent 00470da commit 8a0cd1e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/prototype/lang/hash.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,13 @@ var Hash = Class.create(Enumerable, (function() {
9494

9595
// Our _internal_ each
9696
function _each(iterator, context) {
97+
var i = 0;
9798
for (var key in this._object) {
9899
var value = this._object[key], pair = [key, value];
99100
pair.key = key;
100101
pair.value = value;
101-
iterator.call(context, pair);
102+
iterator.call(context, pair, i);
103+
i++;
102104
}
103105
}
104106

0 commit comments

Comments
 (0)