Skip to content

Commit 2f3fe27

Browse files
author
Akos Kitta
committed
Port: is.
Signed-off-by: Akos Kitta <kittaakos@typefox.io>
1 parent dfed235 commit 2f3fe27

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

arduino-ide-extension/src/common/protocol/boards-service.ts

+4
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ export namespace Port {
9494
}
9595
}
9696

97+
export function is(arg: any): arg is Port {
98+
return !!arg && 'address' in arg && typeof arg['address'] === 'string' && 'protocol' in arg && typeof arg['protocol'] === 'string';
99+
}
100+
97101
export function toString(port: Port, options: { useLabel: boolean } = { useLabel: false }): string {
98102
if (options.useLabel && port.label) {
99103
return `${port.address} ${port.label}`

0 commit comments

Comments
 (0)