Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelhenke committed Dec 15, 2022
2 parents 85e6451 + 2de072f commit f728752
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 22 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"eslint-plugin-no-secrets": "^0.8.9",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-sonarjs": "^0.17.0",
"eslint-plugin-unicorn": "^44.0.2",
"eslint-plugin-unicorn": "^45.0.2",
"eslint-plugin-wc": "^1.3.2",
"html-loader": "^4.1.0",
"husky": "^8.0.1",
Expand Down
16 changes: 7 additions & 9 deletions src/ios-calculator.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,9 @@ export class iOSCalculator extends HTMLElement {
number = this.#getCurrentSolution();
}

if (number.startsWith(CHARACTERS.NEGATIVE)) {
this.#currentInput = number.slice(1);
} else {
this.#currentInput = CHARACTERS.NEGATIVE + number;
}
this.#currentInput = number.startsWith(CHARACTERS.NEGATIVE)
? number.slice(1)
: CHARACTERS.NEGATIVE + number;

this.#displaySolution();
}
Expand Down Expand Up @@ -239,10 +237,7 @@ export class iOSCalculator extends HTMLElement {
this.#currentExpression = this.#currentExpression.slice(0, -1);
}

if (clickedOperand !== CHARACTERS.EQUALS) {
this.#currentExpression += clickedOperand;
addActiveState(operandButton);
} else {
if (clickedOperand === CHARACTERS.EQUALS) {
if (this.#currentExpression.endsWith(')')) {
// clicking = multiple times in a row
const latestOperandIndex = this.#getLatestOperandIndex();
Expand All @@ -253,6 +248,9 @@ export class iOSCalculator extends HTMLElement {
}

this.#currentExpression = `(${this.#currentExpression})`;
} else {
this.#currentExpression += clickedOperand;
addActiveState(operandButton);
}

this.#currentInput = '';
Expand Down
45 changes: 33 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1151,6 +1151,13 @@
resolved "https://registry.yarnpkg.com/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz#1d572bfbbe14b7704e0ba0f39b74815b84870d70"
integrity sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==

"@eslint-community/eslint-utils@^4.1.2":
version "4.1.2"
resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.1.2.tgz#14ca568ddaa291dd19a4a54498badc18c6cfab78"
integrity sha512-7qELuQWWjVDdVsFQ5+beUl+KPczrEDA7S3zM4QUd/bJl7oXgsmpXaEVqrRTnOBqenOV4rWf2kVZk2Ot085zPWA==
dependencies:
eslint-visitor-keys "^3.3.0"

"@eslint/eslintrc@^1.3.3":
version "1.3.3"
resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-1.3.3.tgz#2b044ab39fdfa75b4688184f9e573ce3c5b0ff95"
Expand Down Expand Up @@ -2486,10 +2493,10 @@ chrome-trace-event@^1.0.2:
resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz#1015eced4741e15d06664a957dbbf50d041e26ac"
integrity sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg==

ci-info@^3.4.0:
version "3.5.0"
resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.5.0.tgz#bfac2a29263de4c829d806b1ab478e35091e171f"
integrity sha512-yH4RezKOGlOhxkmhbeNuC4eYZKAUsEaGtBuBzDDP1eFUKiccDWzBABxBfOx31IDwDIXMTxWuwAxUGModvkbuVw==
ci-info@^3.6.1:
version "3.7.0"
resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.7.0.tgz#6d01b3696c59915b6ce057e4aa4adfc2fa25f5ef"
integrity sha512-2CpRNYmImPx+RXKLq6jko/L07phmS9I02TyqkcNU20GCF/GgaWvc58hPtjxDX8lPpkdwc9sNh72V9k00S7ezog==

clean-css@5.2.0:
version "5.2.0"
Expand Down Expand Up @@ -3310,24 +3317,26 @@ eslint-plugin-sonarjs@^0.17.0:
resolved "https://registry.yarnpkg.com/eslint-plugin-sonarjs/-/eslint-plugin-sonarjs-0.17.0.tgz#e026065809e35d286f576ddea094727eeb9cdadd"
integrity sha512-jtGtxI49UbJJeJj7CVRLI3+LLH+y+hkR3GOOwM7vBbci9DEFIRGCWvEd2BJScrzltZ6D6iubukTAfc9cyG7sdw==

eslint-plugin-unicorn@^44.0.2:
version "44.0.2"
resolved "https://registry.yarnpkg.com/eslint-plugin-unicorn/-/eslint-plugin-unicorn-44.0.2.tgz#6324a001c0a5e2ac00fb51b30db27d14c6c36ab3"
integrity sha512-GLIDX1wmeEqpGaKcnMcqRvMVsoabeF0Ton0EX4Th5u6Kmf7RM9WBl705AXFEsns56ESkEs0uyelLuUTvz9Tr0w==
eslint-plugin-unicorn@^45.0.2:
version "45.0.2"
resolved "https://registry.yarnpkg.com/eslint-plugin-unicorn/-/eslint-plugin-unicorn-45.0.2.tgz#d6ba704793a6909fe5dfe013900d2b05b715284c"
integrity sha512-Y0WUDXRyGDMcKLiwgL3zSMpHrXI00xmdyixEGIg90gHnj0PcHY4moNv3Ppje/kDivdAy5vUeUr7z211ImPv2gw==
dependencies:
"@babel/helper-validator-identifier" "^7.19.1"
ci-info "^3.4.0"
"@eslint-community/eslint-utils" "^4.1.2"
ci-info "^3.6.1"
clean-regexp "^1.0.0"
eslint-utils "^3.0.0"
esquery "^1.4.0"
indent-string "^4.0.0"
is-builtin-module "^3.2.0"
jsesc "^3.0.2"
lodash "^4.17.21"
pluralize "^8.0.0"
read-pkg-up "^7.0.1"
regexp-tree "^0.1.24"
regjsparser "^0.9.1"
safe-regex "^2.1.1"
semver "^7.3.7"
semver "^7.3.8"
strip-indent "^3.0.0"

eslint-plugin-wc@^1.2.0, eslint-plugin-wc@^1.3.2:
Expand Down Expand Up @@ -4446,6 +4455,11 @@ jsesc@^2.5.1:
resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4"
integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==

jsesc@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-3.0.2.tgz#bb8b09a6597ba426425f2e4a07245c3d00b9343e"
integrity sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g==

jsesc@~0.5.0:
version "0.5.0"
resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d"
Expand Down Expand Up @@ -5559,6 +5573,13 @@ regjsparser@^0.8.2:
dependencies:
jsesc "~0.5.0"

regjsparser@^0.9.1:
version "0.9.1"
resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.9.1.tgz#272d05aa10c7c1f67095b1ff0addae8442fc5709"
integrity sha512-dQUtn90WanSNl+7mQKcXAgZxvUe7Z0SqXlgzv0za4LwiUhyzBC58yQO3liFoUgu8GiJVInAhJjkj1N0EtQ5nkQ==
dependencies:
jsesc "~0.5.0"

relateurl@^0.2.7:
version "0.2.7"
resolved "https://registry.yarnpkg.com/relateurl/-/relateurl-0.2.7.tgz#54dbf377e51440aca90a4cd274600d3ff2d888a9"
Expand Down Expand Up @@ -5729,7 +5750,7 @@ semver@^6.0.0, semver@^6.1.1, semver@^6.1.2, semver@^6.3.0:
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d"
integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==

semver@^7.3.4, semver@^7.3.7, semver@^7.3.8:
semver@^7.3.4, semver@^7.3.8:
version "7.3.8"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.8.tgz#07a78feafb3f7b32347d725e33de7e2a2df67798"
integrity sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==
Expand Down

0 comments on commit f728752

Please sign in to comment.