We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 68519bd commit 42ceb0cCopy full SHA for 42ceb0c
utils/QueryProcessor.tsx
@@ -19,11 +19,13 @@ export default function QueryProcessor(query: string): string {
19
20
const plusMatch = query
21
.toLowerCase()
22
- .match(/what is\s*(-?\d+(?:\.\d+)?)\s*plus\s*(-?\d+(?:\.\d+)?)\?/);
+ .match(/what is\s*(-?\d+(?:\.\d+)?(?:\s*plus\s*-?\d+(?:\.\d+)?)+)\?/);
23
if (plusMatch) {
24
- const left = Number(plusMatch[1]);
25
- const right = Number(plusMatch[2]);
26
- return (left + right).toString();
+ const sum = plusMatch[1]
+ .split(/\s*plus\s*/)
+ .map((value) => Number(value))
27
+ .reduce((total, value) => total + value, 0);
28
+ return sum.toString();
29
}
30
31
const multiplyMatch = query
0 commit comments