Skip to content

Commit 3dad2bc

Browse files
committed
Replace repetitive comparisons with […].includes()
1 parent a8f69c6 commit 3dad2bc

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/room/errors.ts

+5-3
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)