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

Added filterWhere function to FindWrapper #55

Closed

Conversation

DzikowskiW
Copy link
Contributor

@DzikowskiW DzikowskiW commented Oct 20, 2017

filterWhere function was added mimicking enzyme's functionality
Resolves #54

Copy link
Collaborator

@gnarf gnarf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could also possibly bake this functionality into the existing filter() method, we don't currently have a filter(functionPredicate) but it would be really easy to support.

Perhaps, find(vnode => shouldInclude), filter(vnode => shouldInclude) and filterWhere(wrappedNode => shouldInclude) ?

Thoughts? Either way, lets add a usage example to the docs as this is a fairly complicated use, it would be nice to see the use case.

README.md Outdated
@@ -166,6 +166,9 @@ Returns a new `FindWrapper` with a subset of the previously selected elements gi

Uses the same possible selectors as [`RenderContext#find(selector)`](#rendercontextfindselector).

### `FindWrapper#filterWhere(predicate)`
Returns a new `FindWrapper` with a subset of the previously selected elements which, when passed into the provided predicate function, return true.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A small usage example here would be useful.

@gnarf
Copy link
Collaborator

gnarf commented Oct 24, 2017

Also 😍 thanks for all the submissions!

@mzgoddard
Copy link
Owner

I concur with #55 (review) @gnarf. We can overload find and filter with the function style matching semantics.

@DzikowskiW
Copy link
Contributor Author

I'm sorry for the delay, I had a hectic end of the month, I will have the changes ready by the end of the week.

For this pull request I still need to update README and index.d.ts

@DzikowskiW DzikowskiW closed this Oct 28, 2019
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.

filterWhere function for FindWrapper
3 participants