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

immerMap function #35

Closed
achung89 opened this issue Jan 5, 2018 · 2 comments
Closed

immerMap function #35

achung89 opened this issue Jan 5, 2018 · 2 comments

Comments

@achung89
Copy link

achung89 commented Jan 5, 2018

possibly add an immer implementation that can be used with map/filter/forEach

ex. 
const immerMap = (fn) => 
  (item) => immer( item, fn )

var arr = [['1'], ['2'], ['3']];
arr.map(immerMap((item) => {item.push('new')}));
@hex13
Copy link

hex13 commented Jan 5, 2018

this is why we could use of swap arguments and currying.

(proposal)

arr.map(immer((item) => {item.push('new')}));

@mweststrate
Copy link
Collaborator

Implemented in 0.4.0. See https://github.com/mweststrate/immer#currying. The first example covers the above

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

No branches or pull requests

3 participants