Commit 2895c27
committed
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 #3171 parent ed94e33 commit 2895c27
2 files changed
+41
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
920 | 920 | | |
921 | 921 | | |
922 | 922 | | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
923 | 936 | | |
924 | 937 | | |
925 | 938 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
193 | 221 | | |
194 | 222 | | |
195 | 223 | | |
| |||
0 commit comments