From 78d35ecec3760c8f4f35b9a0be076b8a43780af3 Mon Sep 17 00:00:00 2001 From: TheSavageTeddy <51810476+TheSavageTeddy@users.noreply.github.com> Date: Fri, 25 Nov 2022 10:59:04 +0800 Subject: [PATCH] better boolean statement --- src/core/operations/FromBase85.mjs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/core/operations/FromBase85.mjs b/src/core/operations/FromBase85.mjs index 3904479d..aaa1dc94 100644 --- a/src/core/operations/FromBase85.mjs +++ b/src/core/operations/FromBase85.mjs @@ -113,12 +113,8 @@ class FromBase85 extends Operation { .split("") .map((chr, idx) => { const digit = alphabet.indexOf(chr); - if (digit < 0 || digit > 84) { - if (chr === "z") { - // Pass (Ignore character) - } else { + if ((digit < 0 || digit > 84) && chr !== "z") { throw `Invalid character '${chr}' at index ${i + idx}`; - } } return digit; });