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

Allow memoization of function parameter #159

Merged
merged 5 commits into from
Nov 19, 2018
Merged

Conversation

hc-12
Copy link
Contributor

@hc-12 hc-12 commented Oct 22, 2018

This would allow transformer to accept function as prop which may have custom properties.

This would allow transformer to accept function as prop which may custom properties.
@coveralls
Copy link

coveralls commented Oct 22, 2018

Coverage Status

Coverage increased (+0.3%) to 92.778% when pulling addc4eb on hc-12:patch-2 into 5839f69 on mobxjs:master.

@mweststrate
Copy link
Member

@hc-12 curious about the use case.

Also, could you add a unit test verifying the change?

@hc-12
Copy link
Contributor Author

hc-12 commented Oct 23, 2018

@mweststrate I needed to pass in function that has a prop that i need to check against the observable state.

filteredProp = createTransformer(fn => {
   return this.state.filter(prop => prop === fn.propName);
});

Is there any reason to limit other types besides from null & undefined?

I've updated PR to include test cases. Let me know if any change is required.

@mweststrate mweststrate merged commit 3916cc8 into mobxjs:master Nov 19, 2018
@mweststrate
Copy link
Member

Released as 5.1.0

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

Successfully merging this pull request may close these issues.

4 participants