refactor: remove confusing code practices (#87)

* Prefer `c ? x : y` over `c && x || y`

* Avoid unnecessary asssignment expressions

* Prefer switch statements over object lookup tables

* Add an .editorconfig

* Fix style issues

* Fix mentioned issues

Co-authored-by: bob <bob.varioa@gmail.com>
This commit is contained in:
Bob Varioa
2022-07-01 17:37:59 -05:00
committed by GitHub
parent 3e2b932844
commit 0a851bde31
38 changed files with 418 additions and 243 deletions

View File

@@ -19,9 +19,12 @@ class ToggleButton {
data.defaultText?.accessibility?.accessibilityData.label ||
data?.accessibility?.label;
this.icon_type == 'LIKE' &&
(this.like_count = parseInt(acc_label.replace(/\D/g, ''))) &&
(this.short_like_count = new Text(data.defaultText).toString());
if (this.icon_type == 'LIKE') {
this.like_count = parseInt(acc_label.replace(/\D/g, ''))
if (this.like_count) {
this.short_like_count = new Text(data.defaultText).toString()
}
}
this.endpoint =
data.defaultServiceEndpoint?.commandExecutorCommand?.commands &&