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) { switch(method.method) {
case "domain": case "domain":
return compare( return compare(
entityA.entity_id.split(".")[0], entityA.entity_id.split(".")[0],
entityB.entity_id.split(".")[0] entityB.entity_id.split(".")[0]
); );
case "entity_id": case "entity_id":
return compare( return compare(
entityA.entity_id, entityA.entity_id,
entityB.entity_id entityB.entity_id
); );
case "friendly_name": case "friendly_name":
case "name": case "name":
return compare( return compare(
entityA.attributes.friendly_name || entityA.entity_id.split(".")[1], entityA.attributes.friendly_name || entityA.entity_id.split(".")[1],
entityB.attributes.friendly_name || entityB.entity_id.split(".")[1] entityB.attributes.friendly_name || entityB.entity_id.split(".")[1]
); );
case "state": case "state":
return compare( return compare(
entityA.state, entityA.state,
entityB.state entityB.state
); );
case "attribute": case "attribute":
let _a = entityA.attributes; let _a = entityA.attributes;
let _b = entityB.attributes; let _b = entityB.attributes;
let attr = method.attribute; let attr = method.attribute;
while(attr) { while(attr) {
let k; let k;
[k, attr] = attr.split(":"); [k, attr] = attr.split(":");
_a = _a[k]; _a = _a[k];
_b = _b[k]; _b = _b[k];
if(_a === undefined && _b === undefined) return 0; if(_a === undefined && _b === undefined) return 0;
if(_a === undefined) return lt; if(_a === undefined) return lt;
if(_b === undefined) return gt; if(_b === undefined) return gt;
}
return compare(_a, _b);
default:
return 0;
}
}
} }
return compare(_a, _b);
default:
return 0;
}
}
}