async icon indicating copy to clipboard operation
async copied to clipboard

Collection functions should accept objects

Open aarong opened this issue 15 years ago • 3 comments

I often find myself turning my data objects ({a: 1, b: 2, ...}) into arrays so that I can .map or .forEach them. It would be great if these function could accept objects directly.

aarong avatar Feb 23 '11 13:02 aarong

for the record, see issue #26 as well (not exactly a duplicate but same resolution suggested). Would you expect map and forEach to iterate over the keys ('a', 'b', ...) or the values (1, 2, ...)?

rgabo avatar May 24 '11 13:05 rgabo

Underscore.js gives the iterator the arguments element, index, list if the passed list is an Array, and value, key, list if it is an Object.

jacobrask avatar Jan 06 '12 12:01 jacobrask

This is a duplicate of #168 and should be closed.

brianmaissy avatar Feb 20 '13 12:02 brianmaissy