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 reduce() function for FindWrapper #63

Closed

Conversation

DzikowskiW
Copy link
Contributor

Resolves #62

@gnarf
Copy link
Collaborator

gnarf commented Oct 24, 2017

I really need to see a use case for this...

I'm having a hard time understanding why you'd want a reduce that does FindWrappers of the nodes... Map is an easy one for me, but reduce is getting a bit out there.

@@ -270,6 +270,17 @@ class FindWrapper {
);
}

reduce(fn, initialValue) {
verifyFoundNodes(this);
if (initialValue === undefined) {
Copy link
Owner

Choose a reason for hiding this comment

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

Use the typeof check.

typeof initialValue === 'undefined'

@DzikowskiW
Copy link
Contributor Author

@gnarf there is actually a decent example in enzyme's documentation. I think .map() is much more useful and if you want to keep preact-render-spy's API a bit more constrained, .reduce() is not a necessity, but otherwise it helps once in a while.

If we decide to keep this function, I will add a better README example. Let me know what's your decision on that.

@gnarf
Copy link
Collaborator

gnarf commented May 16, 2018

If we decide to keep this function, I will add a better README example. Let me know what's your decision on that.

I think I need to see that example to want to keep the function :)

@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.

reduce() function for FindWrapper
3 participants