better boolean statement

This commit is contained in:
TheSavageTeddy 2022-11-25 10:59:04 +08:00
parent c79bf5caaf
commit 78d35ecec3

View file

@ -113,12 +113,8 @@ class FromBase85 extends Operation {
.split("") .split("")
.map((chr, idx) => { .map((chr, idx) => {
const digit = alphabet.indexOf(chr); const digit = alphabet.indexOf(chr);
if (digit < 0 || digit > 84) { if ((digit < 0 || digit > 84) && chr !== "z") {
if (chr === "z") {
// Pass (Ignore character)
} else {
throw `Invalid character '${chr}' at index ${i + idx}`; throw `Invalid character '${chr}' at index ${i + idx}`;
}
} }
return digit; return digit;
}); });