> But making map() functions work on hashes makes sense, so why rule
> them out?

There are at least three reasons why this is not a good idea:

1. $.map() is not a real "general purpose" map function. If callback
returns an array then its items will be values because in same cases
it is convenient that a callback can returns multiple values. So if
you make $.map() generic for all "hashes" than you would $.map()
generic for all sequences too.

2. If you make $.map() working with "hashes" too, then you have to
detect which object is a "hash" and which is a sequence. The only
think to do that is to check if the object.length is a number - weak!

3. for(var k in obj) newobj[k] = fn(obj[k])

--

You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-...@googlegroups.com.
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en.


Reply via email to