From 0b9711e77f20de7cc7969de68cd2b3ffbf23ce47 Mon Sep 17 00:00:00 2001 From: zoop-ad <32782664+zoop-ad@users.noreply.github.com> Date: Fri, 31 May 2019 06:50:20 +0530 Subject: [PATCH] Issue #25 - Overrides leftmost zero with next non-zero number (#28) --- src/logic/calculate.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/logic/calculate.js b/src/logic/calculate.js index 6a1225d4c..97e653205 100644 --- a/src/logic/calculate.js +++ b/src/logic/calculate.js @@ -34,8 +34,9 @@ export default function calculate(obj, buttonName) { } // If there is no operation, update next and clear the value if (obj.next) { + const next = obj.next === "0" ? buttonName : obj.next + buttonName; return { - next: obj.next + buttonName, + next, total: null, }; }