Side navigation
#8328 closed enhancement (duplicate)
Opened February 20, 2011 12:01AM UTC
Closed February 21, 2011 01:26AM UTC
Last modified February 21, 2011 01:26AM UTC
$.map supporting objects
Reported by: | jboesch | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | 1.next |
Component: | misc | Version: | 1.5.1rc1 |
Keywords: | needsreview | Cc: | |
Blocked by: | Blocking: |
Description
Pull request here:
https://github.com/jquery/jquery/pull/238
Addresses http://bugs.jquery.com/ticket/2616 and http://bugs.jquery.com/ticket/4459
Since it was 3 years ago, it didn't seem like it's a huge priority. I wanted to make the addition to handle objects without sacrificing the raw speed of $.map for arrays. Underscore.js already implements this: http://documentcloud.github.com/underscore/#map
Here are some benchmarks: http://jsperf.com/old-map-vs-new-map-with-obj-support/2 The last test ($.new_map_forin_2) is the one that is in this pull request.
Some more tests here: http://jsfiddle.net/mmhwZ/16/