UNPKG

matterbridge-roborock-vacuum-plugin

Version:
22 lines (21 loc) 577 B
export class RoomIndexMap { indexMap; roomMap; constructor(roomMap) { this.indexMap = roomMap; this.roomMap = new Map(); for (const [areaId, { roomId, mapId }] of roomMap.entries()) { this.roomMap.set(`${roomId}:${mapId}`, areaId); } } getAreaId(roomId, mapId) { const areaId = this.roomMap.get(`${roomId}:${mapId}`); if (areaId === undefined) { return undefined; } return areaId; } getRoomId(areaId) { return this.indexMap.get(areaId)?.roomId; } }