The iterate processor now passes the item index to the callback.
Showing
1 changed file
with
2 additions
and
2 deletions
... | @@ -254,7 +254,7 @@ getInputValue = (el) -> | ... | @@ -254,7 +254,7 @@ getInputValue = (el) -> |
254 | else el.value | 254 | else el.value |
255 | 255 | ||
256 | iterate = (collection, callback) -> | 256 | iterate = (collection, callback) -> |
257 | callback item for item in collection | 257 | callback item, i for item, i in collection |
258 | 258 | ||
259 | # Core binding routines. | 259 | # Core binding routines. |
260 | Rivets.binders = | 260 | Rivets.binders = |
... | @@ -340,7 +340,7 @@ Rivets.binders = | ... | @@ -340,7 +340,7 @@ Rivets.binders = |
340 | @iterated = iterated = [] | 340 | @iterated = iterated = [] |
341 | 341 | ||
342 | if collection | 342 | if collection |
343 | iterate collection, (item) => | 343 | iterate collection, (item, i) => |
344 | data = {} | 344 | data = {} |
345 | data[n] = m for n, m of @view.models | 345 | data[n] = m for n, m of @view.models |
346 | data[@args[0]] = item | 346 | data[@args[0]] = item | ... | ... |
-
Please register or sign in to post a comment