Skip to content

Commit a6ce96c

Browse files
committed
24parser invalid input
1 parent 7622d2c commit a6ce96c

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

commands/24parser.js

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ const tryCompileAndEvaluate = (eqnString) => {
2121
success: true,
2222
equationOutcome,
2323
};
24-
2524
} catch (e) {
2625
return {
2726
success: false,
@@ -60,17 +59,16 @@ const evaluate = (equationString, target) => {
6059
}
6160

6261
return outcomeAsNumber == target
63-
? {
64-
success: true,
65-
message: `Correct! \`${equationString}\` = ${target}, which is equal to the target.`,
66-
ephemeral: false,
67-
}
68-
: {
69-
success: false,
70-
message: `Incorrect. \`${equationString}\` = ${outcomeAsNumber}, which is not equal to the target of ${target}.`,
71-
ephemeral: false,
72-
};
73-
62+
? {
63+
success: true,
64+
message: `Correct! \`${equationString}\` = ${target}, which is equal to the target.`,
65+
ephemeral: false,
66+
}
67+
: {
68+
success: false,
69+
message: `Incorrect. \`${equationString}\` = ${outcomeAsNumber}, which is not equal to the target of ${target}.`,
70+
ephemeral: false,
71+
};
7472
};
7573

7674
module.exports = {
@@ -98,4 +96,3 @@ module.exports = {
9896
});
9997
},
10098
};
101-

0 commit comments

Comments
 (0)