Skip to content

Commit

Permalink
Added getConnectedHubsByName
Browse files Browse the repository at this point in the history
  • Loading branch information
nathankellenicki committed Feb 1, 2019
1 parent 666e55b commit 9ced6da
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/poweredup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@ export class PoweredUP extends EventEmitter {
}


/**
* Retrieve a list of Powered UP Hubs.
* @method PoweredUP#getConnectedHubs
* @returns {Hub[]}
*/
public getConnectedHubs () {
return Object.keys(this._connectedHubs).map((uuid) => this._connectedHubs[uuid]);
}


/**
* Retrieve a Powered UP Hub by UUID.
* @method PoweredUP#getConnectedHubByUUID
Expand All @@ -107,12 +117,13 @@ export class PoweredUP extends EventEmitter {


/**
* Retrieve a list of Powered UP Hubs.
* @method PoweredUP#getConnectedHubs
* @returns {Hub[]}
* Retrieve a Powered UP Hub by name.
* @method PoweredUP#getConnectedHubsByName
* @param {string} name
* @returns {Hub | null}
*/
public getConnectedHubs () {
return Object.keys(this._connectedHubs).map((uuid) => this._connectedHubs[uuid]);
public getConnectedHubsByName (name: string) {
return Object.keys(this._connectedHubs).map((uuid) => this._connectedHubs[uuid]).filter((hub) => hub.name === name);
}


Expand Down

0 comments on commit 9ced6da

Please sign in to comment.