You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(woql): Add evaluate() method for fluent/chained query style
Fixes issue #317 where WOQL.evaluate() only existed as a functional method
but was missing from the WOQLQuery prototype for fluent/chained style.
## Problem:
Users reported error: "WOQL.limit(...).evaluate is not a function"
- WOQL.evaluate() worked: WOQL.evaluate(expr, var)
- WOQL.limit().evaluate() failed: "evaluate is not a function"
## Root Cause:
- WOQLQuery.prototype.eval() existed for chaining
- WOQLQuery.prototype.evaluate() was missing
- WOQL.evaluate() functional wrapper existed but called eval() internally
## Solution:
Added WOQLQuery.prototype.evaluate() as an alias to eval() for consistency.
**Implementation (woqlQuery.js):**
```javascript
WOQLQuery.prototype.evaluate = function (arithExp, resultVarName) {
return this.eval(arithExp, resultVarName);
};
```
## Testing:
**3 new tests added:**
1. ✅ evaluate() functional style works
2. ✅ evaluate() fluent style works (WOQL.limit(100).evaluate(...))
3. ✅ evaluate() and eval() produce identical results
**All 153 tests passing**
## Usage:
```javascript
// Both naming conventions now work in functional style:
WOQL.eval(WOQL.times(2, 3), 'result')
WOQL.evaluate(WOQL.times(2, 3), 'result')
// Both naming conventions now work in fluent style:
WOQL.limit(100).eval(WOQL.times(2, 3), 'result')
WOQL.limit(100).evaluate(WOQL.times(2, 3), 'result') // ✅ Now works!
```
Resolves#317
0 commit comments