Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map should only produce array; add mapValues and mapKeys #1157

Closed
megawac opened this issue May 13, 2016 · 2 comments
Closed

Map should only produce array; add mapValues and mapKeys #1157

megawac opened this issue May 13, 2016 · 2 comments

Comments

@megawac
Copy link
Collaborator

megawac commented May 13, 2016

There was another issue/pr? for this I made sometime last year but currently map can produce either an object or array because of this line:

https://github.com/caolan/async/blob/master/lib/internal/map.js#L11

I would prefer we follow underscore/lodash lead and produce only arrays from map and then add mapValues and mapKeys for mapping objects (#1133).

This is one of the last changes I want to get into v2. Thoughts @aearly

@aearly
Copy link
Collaborator

aearly commented May 13, 2016

Yes, I like the idea -- one last breaking change that fixes an inconsistency. It's odd that map returns an array for Maps and Sets, but not for objects.

What would the iteratee signatures look like? mapValues(obj, function (value, key, cb) {...}, done) / mapKeys(obj, function (value, key, cb) {...}, done)?

Would mapValues/mapKeys work with Maps too?

This would also come in Series and Limit flavors too.

@aearly
Copy link
Collaborator

aearly commented May 19, 2016

Anyone working on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants