Fix terrible indentation by vscode

This commit is contained in:
Thomas Lovén 2019-11-19 15:57:02 +01:00
parent 7a9f8f14c9
commit eccd2d0cf2
3 changed files with 34 additions and 34 deletions

View File

@ -25,42 +25,42 @@ export function entity_sorter(hass, method) {
}
switch(method.method) {
case "domain":
return compare(
return compare(
entityA.entity_id.split(".")[0],
entityB.entity_id.split(".")[0]
);
case "entity_id":
case "entity_id":
return compare(
entityA.entity_id,
entityB.entity_id
);
case "friendly_name":
case "name":
return compare(
entityA.attributes.friendly_name || entityA.entity_id.split(".")[1],
entityB.attributes.friendly_name || entityB.entity_id.split(".")[1]
);
case "state":
return compare(
entityA.state,
entityB.state
);
case "attribute":
let _a = entityA.attributes;
let _b = entityB.attributes;
let attr = method.attribute;
while(attr) {
let k;
[k, attr] = attr.split(":");
_a = _a[k];
_b = _b[k];
if(_a === undefined && _b === undefined) return 0;
if(_a === undefined) return lt;
if(_b === undefined) return gt;
}
return compare(_a, _b);
default:
return 0;
}
}
case "friendly_name":
case "name":
return compare(
entityA.attributes.friendly_name || entityA.entity_id.split(".")[1],
entityB.attributes.friendly_name || entityB.entity_id.split(".")[1]
);
case "state":
return compare(
entityA.state,
entityB.state
);
case "attribute":
let _a = entityA.attributes;
let _b = entityB.attributes;
let attr = method.attribute;
while(attr) {
let k;
[k, attr] = attr.split(":");
_a = _a[k];
_b = _b[k];
if(_a === undefined && _b === undefined) return 0;
if(_a === undefined) return lt;
if(_b === undefined) return gt;
}
return compare(_a, _b);
default:
return 0;
}
}
}