Skip to content

Use named export for largest series product - #556

Closed
serixscorpio wants to merge 5 commits into
exercism:masterfrom
serixscorpio:436-largest-series-product
Closed

serixscorpio wants to merge 5 commits into
exercism:masterfrom
serixscorpio:436-largest-series-product

Conversation

@serixscorpio

Copy link
Copy Markdown
Contributor

Per #436, convert default export to named export for largest series
product exercise. Change from class style new Series(x).largestProduct(y)
to largestSeriesProduct(x, y) since there is no need to keep state. See 8a38f2f.

As part of this change, I also simplified and linted the pre-existing logic in the example solution (
c2d080c, e9e737b, c450f53 and 40504cf. If these are too noisy to be within the same PR, please let me know. I can break these into a separate PR. Thanks!

Per #436, convert default export to named export for largest series
product exercise. Change from class style `new Series(x).largestProduct(y)`
to `largestSeriesProduct(x, y)` since there is no need to keep state.
This refactor is to validate input as early as possible.
Instead of `forEach`, use `reduce` to convey clearly `max` as an accumulator.
Also, `product` only need to be within the reducing function.
@tejasbubane

Copy link
Copy Markdown
Member

I think it would be better if you move the named export changes to another PR and leave this one for eslint only.

@matthewmorgan

Copy link
Copy Markdown
Contributor

@serixscorpio we appreciate your contributions, truly! But I am in agreement with @tejasbubane that the PRs should be logically separate. Just makes it easier for the easily confused among us to follow the plot :)

@serixscorpio

Copy link
Copy Markdown
Contributor Author

Thanks for your feedback, I'll open a separate PR to lint first, and another one to move to named export (in the order suggested) to reduce the cognitive load. Thanks.

@serixscorpio

Copy link
Copy Markdown
Contributor Author

closing this in favor of alternate PR #561, which does the named export after linting

@serixscorpio
serixscorpio deleted the 436-largest-series-product branch November 20, 2018 22:11
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.

3 participants