code format

This commit is contained in:
Felix Roos 2022-12-13 21:32:03 +01:00
parent 67ad82d52e
commit bf1ba6efc0
17 changed files with 75 additions and 78 deletions

View file

@ -80,16 +80,16 @@ export class Hap {
}
show(compact = false) {
const value = typeof this.value === 'object'
? compact
const value =
typeof this.value === 'object'
? compact
? JSON.stringify(this.value).slice(1, -1).replaceAll('"', '').replaceAll(',', ' ')
: JSON.stringify(this.value)
: this.value
: this.value;
var spans = '';
if (this.whole == undefined) {
spans = '~' + this.part.show;
}
else {
} else {
var is_whole = this.whole.begin.equals(this.part.begin) && this.whole.end.equals(this.part.end);
if (!this.whole.begin.equals(this.part.begin)) {
spans = this.whole.begin.show() + ' ⇜ ';
@ -102,12 +102,10 @@ export class Hap {
spans += ')';
}
if (!this.whole.end.equals(this.part.end)) {
spans += ' ⇝ ' + this.whole.end.show()
spans += ' ⇝ ' + this.whole.end.show();
}
}
return (
'[ ' + spans + ' | ' + value + ' ]'
);
return '[ ' + spans + ' | ' + value + ' ]';
}
showWhole(compact = false) {