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

objects.mapValues #140

Closed
3 tasks done
jkvyff opened this issue Jan 1, 2020 · 2 comments
Closed
3 tasks done

objects.mapValues #140

jkvyff opened this issue Jan 1, 2020 · 2 comments
Labels
enhancement New feature or request operator

Comments

@jkvyff
Copy link
Collaborator

jkvyff commented Jan 1, 2020

Creates an object with the same keys as object and values generated by running each own enumerable string keyed property of object thru iteratee. The iteratee is invoked with three arguments: (value, key, object).

Checklist

  • implementation
  • tests
  • jsdoc

Details

Note: support differs from Lodash by not offering string property path shorthand, must be a function.

const result = objects.mapValues({ a: 1, b: 2, c: 3 }, value => `neat_${value}`);
console.log(result)
> { a: 'neat_1', b: 'neat_2', c: 'neat_3' }

References

@jkvyff jkvyff added enhancement New feature or request operator labels Jan 1, 2020
@evanplaice
Copy link
Member

Good call leaving the string version. Map should represent a transition/function, not property lookup via string.

@evanplaice
Copy link
Member

evanplaice commented Jan 2, 2020

Added in v0.62

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request operator
Projects
None yet
Development

No branches or pull requests

2 participants