Hi Rupert,

You can do that using the MochiKit.Base.items() function:

var foo=[{b:1},{b:2},{b:3}];
var indexed_foo = items(foo); // an array like
[[0,{b:1}],[1,{b:2}],[2,{b:3}]];

Then you can map over this using arg[0] and arg[1] as index and value
respectively.

:)

Regards,
B

>
> Hi there, how about adding a mapi function to Mochikit.Iter which
> passes the index of the item being processed to the specified
> function? It would be really handy, for instance for specifying
> altenate rows on a table.
> Rupert
>
> 

-- 
Morten Barklund



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to