Move conditions to the top
This commit is contained in:
parent
f30dfe0cee
commit
8a0061428d
1 changed files with 9 additions and 4 deletions
|
@ -39,6 +39,14 @@ function extractMetrics(service: Service, timestamp: Date, labels: Record<string
|
|||
const metrics: Metric[] = []
|
||||
|
||||
for (const characteristic of service.characteristics) {
|
||||
if (METRICS_FILTER.includes(characteristic.description)) {
|
||||
continue
|
||||
}
|
||||
|
||||
if (characteristic.value == null) {
|
||||
continue
|
||||
}
|
||||
|
||||
const format = characteristic.format
|
||||
switch (format) {
|
||||
case 'string':
|
||||
|
@ -53,10 +61,7 @@ function extractMetrics(service: Service, timestamp: Date, labels: Record<string
|
|||
case 'uint16':
|
||||
case 'uint32':
|
||||
case 'uint64':
|
||||
if (characteristic.value != null) {
|
||||
if (METRICS_FILTER.includes(characteristic.description)) {
|
||||
break
|
||||
}
|
||||
{
|
||||
const name = formatName(
|
||||
Uuids[service.type] || 'custom',
|
||||
characteristic.description,
|
||||
|
|
Loading…
Reference in a new issue