# All files / api mappers.js

100% Statements 5/5
100% Branches 4/4
100% Functions 1/1
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    213x

    5x

    5x
    13x

    5x

     const deviceFieldMap = {
      device_name: "name",
      device_hard_id: "device_id",
      device_ip: "ip",
      device_type: "type",
      ip_address: "ip",
      mac_address: "mac",
      device_mac: "mac",
      core_version: "firmware_core_version",
    };

    export function unifyDeviceFields(device) {
      const normalized = {};

      for (const [field, value] of Object.entries(device || {})) {
        normalized[deviceFieldMap[field] || field] = value;
      }

      return normalized;
    }