(client: SmartThingsClient)
| 22 | } |
| 23 | |
| 24 | const buildLocationNamesById = async (client: SmartThingsClient): Promise<Map<string, string>> => { |
| 25 | const locations = await client.locations.list() |
| 26 | return new Map(locations.map(location => [location.locationId, location.name])) |
| 27 | } |
| 28 | |
| 29 | export const withLocations = async <T>(client: SmartThingsClient, list: (T & WithLocation)[]): Promise<(T & WithNamedLocation)[]> => { |
| 30 | const locationNameById = await buildLocationNamesById(client) |
no outgoing calls
no test coverage detected