Skip to content

Commit

Permalink
Replace repetitive comparisons with […].includes()
Browse files Browse the repository at this point in the history
  • Loading branch information
Philzen committed Jan 14, 2025
1 parent a8f69c6 commit 3dad2bc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/room/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,15 @@ export namespace MediaDeviceFailure {
return undefined;
}

if (error.name === 'NotFoundError' || error.name === 'DevicesNotFoundError') {
if (['NotFoundError', 'DevicesNotFoundError'].includes(error.name)) {
return MediaDeviceFailure.NotFound;
}
if (error.name === 'NotAllowedError' || error.name === 'PermissionDeniedError') {

if (['NotAllowedError', 'PermissionDeniedError'].includes(error.name)) {
return MediaDeviceFailure.PermissionDenied;
}
if (error.name === 'NotReadableError' || error.name === 'TrackStartError') {

if (['NotReadableError', 'TrackStartError'].includes(error.name)) {
return MediaDeviceFailure.DeviceInUse;
}

Expand Down

0 comments on commit 3dad2bc

Please sign in to comment.