Hi, today I realized jQuery.map doesn't support hashes(associative arrays). I'm surprised, this is a behavior I'd assume it'd be included.
I added the changes to make this possible. In addition, added a third, optional, argument that is the return object. So it's possible to map on a existing object.
I made it so flexible, that one can map from an array to a hash, and the other way around as well.
This is mostly useful to collect the keys or values from a hash, or to map an array of elements to an object(like setArray).
It will handle array-like objects, and will treat them as arrays
I optimized the array concatenation, so now it's only done once, in the end, and now, there's no need for array-wrapping the returned data.
I think the length of the code remains more or less the same, so this should be doable.
I tested all the cases in IE6, FF2, Safari 3, and Opera 9.
I hope this helps