mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-07-07 19:36:33 +00:00
Port: is
.
Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
parent
dfed2350bd
commit
2f3fe27da3
@ -94,6 +94,10 @@ export namespace Port {
|
||||
}
|
||||
}
|
||||
|
||||
export function is(arg: any): arg is Port {
|
||||
return !!arg && 'address' in arg && typeof arg['address'] === 'string' && 'protocol' in arg && typeof arg['protocol'] === 'string';
|
||||
}
|
||||
|
||||
export function toString(port: Port, options: { useLabel: boolean } = { useLabel: false }): string {
|
||||
if (options.useLabel && port.label) {
|
||||
return `${port.address} ${port.label}`
|
||||
|
Loading…
x
Reference in New Issue
Block a user