Merge pull request #34 from nutki/pr-2
allow case insensitive port names
This commit is contained in:
commit
be132bd9e8
10
src/hub.ts
10
src/hub.ts
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user