MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / calculate

Method calculate

calc/calc.ts:192–196  ·  view source on GitHub ↗
(expression: string)

Source from the content-addressed store, hash-verified

190 private static isNumber(token: string): boolean {
191 return /^-?\d+(\.\d+)?$/.test(token);
192 }
193
194 static calculate(expression: string): number {
195 const tokens = this.tokenize(expression);
196 const postfix = this.infixToPostfix(tokens);
197 return this.evaluatePostfix(postfix);
198 }
199}

Callers 1

handleCalcMethod · 0.80

Calls 3

tokenizeMethod · 0.95
infixToPostfixMethod · 0.95
evaluatePostfixMethod · 0.95

Tested by

no test coverage detected