MCPcopy Create free account
hub / github.com/CaviraOSS/OpenReason / solveMath

Function solveMath

src/engines/math.ts:1–7  ·  view source on GitHub ↗
(query: string)

Source from the content-addressed store, hash-verified

1export function solveMath(query: string): string | null {
2 const add = query.match(/(\d+)\s*\+\s*(\d+)/)
3 if (add) return String(parseInt(add[1], 10) + parseInt(add[2], 10))
4 const mul = query.match(/(\d+)\s*\*\s*(\d+)/)
5 if (mul) return String(parseInt(mul[1], 10) * parseInt(mul[2], 10))
6 return null
7}

Callers 1

quick_respondFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected