Skip to content

Conversation

@Juneezee
Copy link
Contributor

@Juneezee Juneezee commented May 4, 2023

Hello 👋, first-time contributor here.

This PR replaces the use of .indexOf with .includes for cases where the method is used to check if an array contains a particular element. This results in improved code readability and better adherence to modern JavaScript best practices.

The replaced code snippets include:

  1. .indexOf(...) === -1
  2. .indexOf(...) !== -1
  3. .indexOf(...) > -1
  4. .indexOf(...) >= 0

This commit replaces the use of `.indexOf` with `.includes` for cases
where the method is used to check if an array contains a particular
element. This results in improved code readability and better adherence
to modern JavaScript best practices.

The replaced code snippets include:

	- `.indexOf(...) === -1`
	- `.indexOf(...) > -1`
	- `.indexOf(...) >= 0`

Signed-off-by: Eng Zer Jun <[email protected]>
@Antreesy
Copy link
Contributor

Antreesy commented May 4, 2023

Hello , first-time contributor here.

Hello! Thanks for efforts you did to make our product better!
That is a good improvement, please give us a day to test these changes 🦭

Copy link
Contributor

@Antreesy Antreesy left a comment

Choose a reason for hiding this comment

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

Tests are passed, all entries also manually tested 🦭
Good job!

methods: {
isParticipantTypeModerator(participantType) {
return [PARTICIPANT.TYPE.OWNER, PARTICIPANT.TYPE.MODERATOR, PARTICIPANT.TYPE.GUEST_MODERATOR].indexOf(participantType) !== -1
return [PARTICIPANT.TYPE.OWNER, PARTICIPANT.TYPE.MODERATOR, PARTICIPANT.TYPE.GUEST_MODERATOR].includes(participantType)
Copy link
Contributor

Choose a reason for hiding this comment

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

Note for myself @Antreesy:
method is not used in project since for a while, can be deleted

Copy link
Contributor

Choose a reason for hiding this comment

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

And there is also some indexOf in the project
Feel free to make another PR =)
image

@Antreesy Antreesy merged commit e1b60c0 into nextcloud:master May 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants