MCPcopy Index your code
hub / github.com/JavaScriptRegenerated/yieldparser / MathExpression

Function MathExpression

src/math.test.ts:32–46  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

30 }
31
32 function* MathExpression(): ParseGenerator {
33 yield whitespaceMay;
34 let current: number = yield ParseInt;
35
36 while (yield hasMore) {
37 yield whitespaceMay;
38 const operator: Operator = yield ParseOperator;
39 yield whitespaceMay;
40 const other = yield ParseInt;
41
42 current = applyOperator(current, other, operator);
43 }
44
45 return current;
46 }
47
48 test.each([
49 ['1 + 1', 2],

Callers 1

math.test.tsFile · 0.85

Calls 1

applyOperatorFunction · 0.85

Tested by

no test coverage detected