allow case insensitive port names

This commit is contained in:
Michal Szafranski 2019-11-02 15:23:33 +01:00
parent 9a9d3ee4d5
commit 0b1c5008f3

View File

@ -354,11 +354,13 @@ export class Hub extends EventEmitter {
} }
protected _portLookup (port: string) { protected _portLookup (portName: string) {
if (!this._ports[port.toUpperCase()] && !this._virtualPorts[port.toUpperCase()]) { const portNameUpper = portName.toUpperCase();
throw new Error(`Port ${port.toUpperCase()} does not exist on this Hub type`); const port = this._ports[portNameUpper] || this._virtualPorts[portNameUpper];
if (!port) {
throw new Error(`Port ${portNameUpper} does not exist on this Hub type`);
} }
return this._ports[port] || this._virtualPorts[port]; return port;
} }