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

refactor: collection-factory create method #1907

Merged
merged 1 commit into from
Feb 3, 2023
Merged

refactor: collection-factory create method #1907

merged 1 commit into from
Feb 3, 2023

Conversation

recepkefelii
Copy link
Contributor

@recepkefelii recepkefelii commented Jan 29, 2023

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[ ] Feature
[] Code style update (formatting, local variables)
[x] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

The original code used a switch statement to determine which type of AbstractCollection instance to return. The new code uses a conditional if statement to perform the same task, which makes the code more concise and readable. Additionally, the instantiation of the SchematicRunner object was moved outside of the conditional statement, so that it only needs to be created once, improving the performance of the code.

Does this PR introduce a breaking change?

[ ] Yes
[x] No

@micalevisk
Copy link
Member

so that it only needs to be created once, improving the performance of the code.

the old version creates it once too as the 'case' is evaluated only one time.

But yours is more clean to me.

@recepkefelii
Copy link
Contributor Author

so that it only needs to be created once, improving the performance of the code.

the old version creates it once too as the 'case' is evaluated only one time.

But yours is more clean to me.

thanks

@kamilmysliwiec kamilmysliwiec merged commit 1c2319a into nestjs:master Feb 3, 2023
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