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

[doc]fix error example #2064

Merged
merged 1 commit into from Mar 24, 2019
Merged

[doc]fix error example #2064

merged 1 commit into from Mar 24, 2019

Conversation

Tankunpeng
Copy link
Contributor

const total = wrapper.find(Bar).reduce((amount, n) => amount + n.prop('amount'));

In this example, total is an Object, because of there is no initial reduce value. we must set the initial value with 0 to get the right result.
And, the right result is 14.

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

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

Thanks, good catch. Can you confirm the mount docs for reduce don’t need the same fix?

@ljharb ljharb added the docs label Mar 24, 2019
@ljharb ljharb mentioned this pull request Mar 24, 2019
@Tankunpeng
Copy link
Contributor Author

Sorry, the mount docs also need fix. I start a new pull request. #2066

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

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

Thanks!

@ljharb ljharb merged commit 0c3277c into enzymejs:master Mar 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants