Skip to content

Commit 29f41de

Browse files
committed
Replace repetitive comparisons with […].includes()
1 parent ff36fb8 commit 29f41de

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/room/errors.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,15 @@ export namespace MediaDeviceFailure {
102102
return undefined
103103
}
104104

105-
if (error.name === 'NotFoundError' || error.name === 'DevicesNotFoundError') {
105+
if (['NotFoundError', 'DevicesNotFoundError'].includes(error.name)) {
106106
return MediaDeviceFailure.NotFound;
107107
}
108-
if (error.name === 'NotAllowedError' || error.name === 'PermissionDeniedError') {
108+
109+
if (['NotAllowedError', 'PermissionDeniedError'].includes(error.name)) {
109110
return MediaDeviceFailure.PermissionDenied;
110111
}
111-
if (error.name === 'NotReadableError' || error.name === 'TrackStartError') {
112+
113+
if (['NotReadableError', 'TrackStartError'].includes(error.name)) {
112114
return MediaDeviceFailure.DeviceInUse;
113115
}
114116

0 commit comments

Comments
 (0)