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: move to const variables and simplify conditionals #666

Merged
merged 18 commits into from
Jul 18, 2023

Conversation

ahmed0saber
Copy link
Contributor

No description provided.

The variable "matched" has not been reassigned a value, so it's better to use "const" instead of "let", to prevent any unexpected behavior that may occur due to unintended assignment.
In this commit, I tried to make the code more cleaner by:
- using the spread syntax to simplify the Object.assign method. This combines the default classes with the settings classes using the spread operator to create a new object that contains all the properties.
- using a loop and square brackets notation, to merge all properties in a dynamic way, instead of adding each one with a lot of duplicate code.
In this commit, I tried to make the code more cleaner by:
- using "const" instead of "let" with unassignable functions.
- using default parameter instead of using "if no options".
The variables have not been reassigned a value, so it's better to use "const" instead of "let", to prevent any unexpected behavior that may occur due to unintended assignment.
The variable has not been reassigned a value, so it's better to use "const" instead of "let", to prevent any unexpected behavior that may occur due to unintended assignment.
The variable has not been reassigned a value, so it's better to use "const" instead of "let", to prevent any unexpected behavior that may occur due to unintended assignment.
The variables have not been reassigned a value, so it's better to use "const" instead of "let", to prevent any unexpected behavior that may occur due to unintended assignment.
- The variables have not been reassigned a value, so it's better to use "const" instead of "let", to prevent any unexpected behavior that may occur due to unintended assignment.
- Using "slides.length > 0" is cleaner than "slides.length !== 0" because the second one means "(slides.length > 0) || slides.length < 0", and it can't be less than zero.
- The variables have not been reassigned a value, so it's better to use "const" instead of "let", to prevent any unexpected behavior that may occur due to unintended assignment.
- In line 92, we return if there is no item, so there is no need to check for item again in line 96.
- in removeClass, we can simplify this if statement by using optional chaining operator.
The variable has not been reassigned a value, so it's better to use "const" instead of "let", to prevent any unexpected behavior that may occur due to unintended assignment.
The variables have not been reassigned a value, so it's better to use "const" instead of "let", to prevent any unexpected behavior that may occur due to unintended assignment.
- Highlighting the difference between the two different statements by creating an object that contains both the symbols.
- Using "includes" for a more dynamic and readable condition.
- Using square brackets notation to avoid duplicate code.
The variables have not been reassigned a value, so it's better to use "const" instead of "let", to prevent any unexpected behavior that may occur due to unintended assignment.
The variables have not been reassigned a value, so it's better to use "const" instead of "let", to prevent any unexpected behavior that may occur due to unintended assignment.
The variables have not been reassigned a value, so it's better to use "const" instead of "let", to prevent any unexpected behavior that may occur due to unintended assignment.
The variables have not been reassigned a value, so it's better to use "const" instead of "let", to prevent any unexpected behavior that may occur due to unintended assignment.
- The variables have not been reassigned a value, so it's better to use "const" instead of "let", to prevent any unexpected behavior that may occur due to unintended assignment.
- Removing "NOT" from if statement to make it more readable.
The variable has not been reassigned a value, so it's better to use "const" instead of "let", to prevent any unexpected behavior that may occur due to unintended assignment.
@jedrzejchalubek jedrzejchalubek changed the title Review and refactor all files in src folder refactor: move to const variables and simplify conditionals Jul 18, 2023
@jedrzejchalubek jedrzejchalubek merged commit 236210c into glidejs:master Jul 18, 2023
@jedrzejchalubek
Copy link
Member

Thanks!

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.

2 participants