Skip to content

Commit 4bad40b

Browse files
committed
Sonar II
1 parent 2b8ff38 commit 4bad40b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/js/serial.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,15 @@ class Serial extends EventTarget {
7474
// Determine which protocol to use based on port path
7575
const s = typeof portPath === "string" ? portPath : "";
7676
// Default to webserial for typical serial device identifiers.
77-
if (s === "virtual") return this._protocols.find((p) => p.name === "virtual")?.instance;
77+
if (s === "virtual") {
78+
return this._protocols.find((p) => p.name === "virtual")?.instance;
79+
}
7880
if (s === "manual" || /^(tcp|ws|wss):\/\/[A-Za-z0-9.-]+(?::\d+)?(\/.*)?$/.test(s)) {
7981
return this._protocols.find((p) => p.name === "websocket")?.instance;
8082
}
81-
if (s.startsWith("bluetooth")) return this._protocols.find((p) => p.name === "webbluetooth")?.instance;
83+
if (s.startsWith("bluetooth")) {
84+
return this._protocols.find((p) => p.name === "webbluetooth")?.instance;
85+
}
8286
return this._protocols.find((p) => p.name === "webserial")?.instance;
8387
}
8488

0 commit comments

Comments
 (0)