Skip to content

refactor: move to const variables and simplify conditionals#666

Merged
jedrzejchalubek merged 18 commits intoglidejs:masterfrom
ahmed0saber:master
Jul 18, 2023
Merged

refactor: move to const variables and simplify conditionals#666
jedrzejchalubek merged 18 commits intoglidejs:masterfrom
ahmed0saber:master

Conversation

@ahmed0saber
Copy link
Copy Markdown
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
Copy Markdown
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