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

_.mapKeys to map object keys #2526

Closed
arypbatista opened this issue May 3, 2016 · 3 comments
Closed

_.mapKeys to map object keys #2526

arypbatista opened this issue May 3, 2016 · 3 comments
Labels

Comments

@arypbatista
Copy link

arypbatista commented May 3, 2016

Map object keys and returning a new object with key mapped.

let _ = require('underscore');

module.exports = (o, f) =>
  _.object(
    _.map(
      _.pairs(o), (keyValue) => [f(keyValue[0], keyValue[1]), keyValue[1]]
    )
  );

@akre54 akre54 added the wontfix label May 3, 2016
@akre54
Copy link
Collaborator

akre54 commented May 3, 2016

Try _.keys with a _.map.

@akre54 akre54 closed this as completed May 3, 2016
@arypbatista
Copy link
Author

I want to have a function that returns an object with mapped keys.

mapKeys :: ( Object, KeyMappingFunction ) -> Object

This is more than combining _.keys and _.map.

@jdalton
Copy link
Contributor

jdalton commented May 4, 2016

See lodash/mapKeys or lodash.mapkeys.

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

No branches or pull requests

3 participants