@jbrowse/jexl 2.3.1 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/LICENSE.txt +1 -0
  3. package/README.md +76 -74
  4. package/dist/Expression.d.ts +2 -12
  5. package/dist/Expression.js +5 -27
  6. package/dist/Expression.js.map +1 -1
  7. package/dist/Jexl.d.ts +6 -40
  8. package/dist/Jexl.js +7 -49
  9. package/dist/Jexl.js.map +1 -1
  10. package/dist/evaluator/Evaluator.d.ts +14 -55
  11. package/dist/evaluator/Evaluator.js +14 -73
  12. package/dist/evaluator/Evaluator.js.map +1 -1
  13. package/dist/evaluator/handlers.d.ts +19 -18
  14. package/dist/evaluator/handlers.js +54 -62
  15. package/dist/evaluator/handlers.js.map +1 -1
  16. package/dist/grammar.d.ts +3 -4
  17. package/dist/grammar.js +16 -39
  18. package/dist/grammar.js.map +1 -1
  19. package/esm/Expression.d.ts +2 -12
  20. package/esm/Expression.js +5 -27
  21. package/esm/Expression.js.map +1 -1
  22. package/esm/Jexl.d.ts +6 -40
  23. package/esm/Jexl.js +7 -49
  24. package/esm/Jexl.js.map +1 -1
  25. package/esm/evaluator/Evaluator.d.ts +14 -55
  26. package/esm/evaluator/Evaluator.js +14 -73
  27. package/esm/evaluator/Evaluator.js.map +1 -1
  28. package/esm/evaluator/handlers.d.ts +19 -18
  29. package/esm/evaluator/handlers.js +54 -62
  30. package/esm/evaluator/handlers.js.map +1 -1
  31. package/esm/grammar.d.ts +3 -4
  32. package/esm/grammar.js +16 -39
  33. package/esm/grammar.js.map +1 -1
  34. package/package.json +2 -1
  35. package/src/Expression.ts +5 -36
  36. package/src/Jexl.ts +7 -54
  37. package/src/evaluator/Evaluator.ts +14 -92
  38. package/src/evaluator/handlers.ts +54 -68
  39. package/src/grammar.ts +17 -38
  40. package/src/types.ts +4 -1
  41. package/dist/PromiseSync.d.ts +0 -13
  42. package/dist/PromiseSync.js +0 -80
  43. package/dist/PromiseSync.js.map +0 -1
  44. package/esm/PromiseSync.d.ts +0 -13
  45. package/esm/PromiseSync.js +0 -78
  46. package/esm/PromiseSync.js.map +0 -1
  47. package/src/PromiseSync.ts +0 -86
package/CHANGELOG.md CHANGED
@@ -6,6 +6,33 @@ This project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
7
  Nothing yet!
8
8
 
9
+ ## [v3.0.0]
10
+
11
+ ### BREAKING CHANGES
12
+
13
+ - **Removed async evaluation support**: Jexl now only supports synchronous evaluation
14
+ - **Renamed methods**: `evalSync()` has been renamed to `eval()`. The async `eval()` method has been removed.
15
+ - **Removed PromiseSync class**: Internal implementation detail removed
16
+ - **Removed transforms**: The transform/pipe operator (`|`) has been completely removed. Use functions instead.
17
+ - **Removed array filtering**: Relative filter expressions (e.g., `array[.property == value]`) have been removed. Bracket notation for array/object access (e.g., `array[0]`, `object["key"]`) still works.
18
+ - **Removed transform methods**: `addTransform()`, `addTransforms()`, and `getTransform()` have been removed.
19
+
20
+ ### Changed
21
+
22
+ - Simplified codebase by removing Promise/PromiseSync abstraction layer
23
+ - All evaluation is now synchronous, improving performance and simplifying error handling
24
+ - Errors are now thrown directly rather than being rejected Promises
25
+ - Removed pipe operator (`|`) from grammar
26
+ - Removed filter bracket syntax for relative filtering
27
+
28
+ ### Migration Guide
29
+
30
+ - Replace `await jexl.eval(expr)` with `jexl.eval(expr)` (remove await)
31
+ - Replace `jexl.evalSync(expr)` with `jexl.eval(expr)` (remove Sync suffix)
32
+ - Replace transforms with functions: change `value|transform(arg)` to `transform(value, arg)`
33
+ - Remove uses of relative filtering syntax `array[.prop == value]` (note: direct indexing like `array[0]` still works)
34
+ - Replace `.catch()` error handling with `try/catch` blocks
35
+
9
36
  ## [v2.3.0]
10
37
 
11
38
  ### Added
package/LICENSE.txt CHANGED
@@ -1,3 +1,4 @@
1
+ Copyright (c) 2025 Colin Diesh
1
2
  Copyright (c) 2020 Tom Shawver
2
3
 
3
4
  Permission is hereby granted, free of charge, to any person obtaining a copy
package/README.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  A fork of the jexl lang for jbrowse
4
4
 
5
+ ## What's New in v3.0
6
+
7
+ Version 3.0 is a major simplification of Jexl with breaking changes:
8
+
9
+ - **Synchronous only** - All evaluation is synchronous. No async/await needed.
10
+ - **No transforms** - The pipe operator (`|`) has been removed. Use functions instead.
11
+ - **No filter expressions** - Relative filter syntax like `array[.property == value]` has been removed. Regular bracket notation for indexing (`array[0]`, `object["key"]`) still works.
12
+
13
+ See [CHANGELOG.md](CHANGELOG.md) for migration guide.
14
+
5
15
  ## Quick Examples
6
16
 
7
17
  ```javascript
@@ -16,30 +26,26 @@ const context = {
16
26
  }
17
27
 
18
28
  // Template strings with interpolation
19
- jexl.evalSync('`Hello ${name.first} ${name.last}`', context)
29
+ jexl.eval('`Hello ${name.first} ${name.last}`', context)
20
30
  // "Hello Sterling Archer"
21
31
 
22
- jexl.evalSync('`Age in 5 years: ${age + 5}`', context)
32
+ jexl.eval('`Age in 5 years: ${age + 5}`', context)
23
33
  // "Age in 5 years: 41"
24
34
 
25
- // Filter arrays
26
- jexl.evalSync('assoc[.first == "Lana"].last', context)
27
- // "Kane"
28
-
29
35
  // Math operations
30
- jexl.evalSync('age * (3 - 1)', context)
36
+ jexl.eval('age * (3 - 1)', context)
31
37
  // 72
32
38
 
33
39
  // String concatenation
34
- jexl.evalSync('name.first + " " + name.last', context)
40
+ jexl.eval('name.first + " " + name.last', context)
35
41
  // "Sterling Archer"
36
42
 
37
43
  // Conditional logic
38
- jexl.evalSync('age > 62 ? "retired" : "working"', context)
44
+ jexl.eval('age > 62 ? "retired" : "working"', context)
39
45
  // "working"
40
46
 
41
47
  // Array indexes
42
- jexl.evalSync('assoc[1].first', context)
48
+ jexl.eval('assoc[1].first', context)
43
49
  // "Cyril"
44
50
  ```
45
51
 
@@ -63,17 +69,17 @@ Template strings use backticks and support expression interpolation with `${}`:
63
69
  ```javascript
64
70
  const context = { name: 'World', price: 10, qty: 3 }
65
71
 
66
- jexl.evalSync('`Hello ${name}!`', context)
72
+ jexl.eval('`Hello ${name}!`', context)
67
73
  // "Hello World!"
68
74
 
69
- jexl.evalSync('`Total: $${price * qty}`', context)
75
+ jexl.eval('`Total: $${price * qty}`', context)
70
76
  // "Total: $30"
71
77
 
72
78
  // Escape backticks and dollar signs with backslash
73
- jexl.evalSync('`Code: \\`example\\``')
79
+ jexl.eval('`Code: \\`example\\``')
74
80
  // "Code: `example`"
75
81
 
76
- jexl.evalSync('`Price: \\$100`')
82
+ jexl.eval('`Price: \\$100`')
77
83
  // "Price: $100"
78
84
  ```
79
85
 
@@ -103,49 +109,10 @@ const context = {
103
109
  lastEx: 2
104
110
  }
105
111
 
106
- jexl.evalSync('name.first', context) // "Malory"
107
- jexl.evalSync('name["last"]', context) // "Archer"
108
- jexl.evalSync('exes[2]', context) // "Burt"
109
- jexl.evalSync('exes[lastEx - 1]', context) // "Len"
110
- ```
111
-
112
- ### Filtering Collections
113
-
114
- Filter arrays using expressions in brackets. Reference properties with a leading dot:
115
-
116
- ```javascript
117
- const context = {
118
- employees: [
119
- { first: 'Sterling', last: 'Archer', age: 36 },
120
- { first: 'Malory', last: 'Archer', age: 75 },
121
- { first: 'Lana', last: 'Kane', age: 33 },
122
- { first: 'Cyril', last: 'Figgis', age: 45 }
123
- ]
124
- }
125
-
126
- jexl.evalSync('employees[.first == "Sterling"]', context)
127
- // [{ first: 'Sterling', last: 'Archer', age: 36 }]
128
-
129
- jexl.evalSync('employees[.age >= 30 && .age < 40]', context)
130
- // [{ first: 'Sterling', ... }, { first: 'Lana', ... }]
131
-
132
- jexl.evalSync('employees[.last == "Kane"].first', context)
133
- // "Lana"
134
- ```
135
-
136
- ### Transforms
137
-
138
- Apply transforms to values using the pipe operator:
139
-
140
- ```javascript
141
- jexl.addTransform('upper', (val) => val.toUpperCase())
142
- jexl.addTransform('split', (val, char) => val.split(char))
143
-
144
- jexl.evalSync('"hello"|upper')
145
- // "HELLO"
146
-
147
- jexl.evalSync('"firstName lastName"|split(" ")[0]')
148
- // "firstName"
112
+ jexl.eval('name.first', context) // "Malory"
113
+ jexl.eval('name["last"]', context) // "Archer"
114
+ jexl.eval('exes[2]', context) // "Burt"
115
+ jexl.eval('exes[lastEx - 1]', context) // "Len"
149
116
  ```
150
117
 
151
118
  ### Functions
@@ -156,10 +123,10 @@ Call functions in expressions:
156
123
  jexl.addFunction('min', Math.min)
157
124
  jexl.addFunction('max', Math.max)
158
125
 
159
- jexl.evalSync('min(5, 2, 9)')
126
+ jexl.eval('min(5, 2, 9)')
160
127
  // 2
161
128
 
162
- jexl.evalSync('max(temperature, threshold)')
129
+ jexl.eval('max(temperature, threshold)')
163
130
  // evaluates with context
164
131
  ```
165
132
 
@@ -168,10 +135,10 @@ jexl.evalSync('max(temperature, threshold)')
168
135
  Separate multiple expressions with semicolons. The result is the value of the last expression:
169
136
 
170
137
  ```javascript
171
- jexl.evalSync('5; 10; 15')
138
+ jexl.eval('5; 10; 15')
172
139
  // 15
173
140
 
174
- jexl.evalSync('1 + 1; 2 + 2; 3 + 3')
141
+ jexl.eval('1 + 1; 2 + 2; 3 + 3')
175
142
  // 6
176
143
  ```
177
144
 
@@ -180,37 +147,72 @@ jexl.evalSync('1 + 1; 2 + 2; 3 + 3')
180
147
  Assign values to variables using `=` (no `let`, `var`, or `const` needed). Assignments mutate the context and return the assigned value:
181
148
 
182
149
  ```javascript
183
- jexl.evalSync('x = 5')
150
+ jexl.eval('x = 5')
184
151
  // 5
185
152
 
186
- jexl.evalSync('x = 5; x * 2')
153
+ jexl.eval('x = 5; x * 2')
187
154
  // 10
188
155
 
189
- jexl.evalSync('x = 5; y = 10; x + y')
156
+ jexl.eval('x = 5; y = 10; x + y')
190
157
  // 15
191
158
 
192
159
  const context = {}
193
- jexl.evalSync('x = 5; y = x * 2; y', context)
160
+ jexl.eval('x = 5; y = x * 2; y', context)
194
161
  // 10
195
162
  // context is now { x: 5, y: 10 }
196
163
  ```
197
164
 
198
- ## Usage
165
+ ## API
199
166
 
200
- ```javascript
201
- import jexl from 'jexl'
167
+ ### Evaluation
202
168
 
203
- // Synchronous evaluation
204
- const result = jexl.evalSync('expression', context)
169
+ ```javascript
170
+ import jexl from '@jbrowse/jexl'
205
171
 
206
- // Asynchronous evaluation (supports async transforms/functions)
207
- const result = await jexl.eval('expression', context)
172
+ // Evaluate an expression
173
+ const result = jexl.eval('expression', context)
208
174
 
209
175
  // Compile once, evaluate many times
210
176
  const expr = jexl.compile('name.first + " " + name.last')
211
- expr.evalSync({ name: { first: 'John', last: 'Doe' } })
177
+ const result = expr.eval({ name: { first: 'John', last: 'Doe' } })
178
+ ```
179
+
180
+ ### Adding Custom Functions
181
+
182
+ ```javascript
183
+ // Add a single function
184
+ jexl.addFunction('round', Math.round)
185
+ jexl.addFunction('lower', (str) => str.toLowerCase())
186
+
187
+ // Add multiple functions
188
+ jexl.addFunctions({
189
+ min: Math.min,
190
+ max: Math.max,
191
+ abs: Math.abs
192
+ })
193
+
194
+ // Use in expressions
195
+ jexl.eval('round(3.7)') // 4
196
+ jexl.eval('lower(name)', { name: 'HELLO' }) // "hello"
197
+ jexl.eval('max(1, 5, 3)') // 5
198
+ ```
199
+
200
+ ### Adding Custom Operators
201
+
202
+ ```javascript
203
+ // Add a binary operator
204
+ jexl.addBinaryOp('~=', 20, (left, right) =>
205
+ left.toLowerCase() === right.toLowerCase()
206
+ )
207
+
208
+ jexl.eval('"Hello" ~= "hello"') // true
209
+
210
+ // Add a unary operator
211
+ jexl.addUnaryOp('~', (right) => Math.floor(right))
212
+
213
+ jexl.eval('~3.7') // 3
212
214
  ```
213
215
 
214
216
  ## License
215
217
 
216
- MIT License - see LICENSE.txt for details
218
+ MIT License, same as TomFrost/Jexl
@@ -1,10 +1,8 @@
1
- import PromiseSync from './PromiseSync.ts';
2
1
  import type { AstNode } from './types.ts';
3
2
  interface Grammar {
4
3
  elements: Record<string, any>;
5
4
  [key: string]: any;
6
5
  }
7
- type PromiseConstructor = typeof Promise | typeof PromiseSync;
8
6
  declare class Expression {
9
7
  _grammar: Grammar;
10
8
  _exprStr: string;
@@ -18,21 +16,13 @@ declare class Expression {
18
16
  */
19
17
  compile(): this;
20
18
  /**
21
- * Asynchronously evaluates the expression within an optional context.
22
- * @param {Object} [context] A mapping of variables to values, which will be
23
- * made accessible to the Jexl expression when evaluating it
24
- * @returns {Promise<*>} resolves with the result of the evaluation.
25
- */
26
- eval(context?: {}): Promise<any> | PromiseSync<any>;
27
- /**
28
- * Synchronously evaluates the expression within an optional context.
19
+ * Evaluates the expression within an optional context.
29
20
  * @param {Object} [context] A mapping of variables to values, which will be
30
21
  * made accessible to the Jexl expression when evaluating it
31
22
  * @returns {*} the result of the evaluation.
32
23
  * @throws {*} on error
33
24
  */
34
- evalSync(context?: {}): unknown;
35
- _eval(context: any, promise: PromiseConstructor): Promise<any> | PromiseSync<any>;
25
+ eval(context?: {}): any;
36
26
  _getAst(): AstNode | null;
37
27
  }
38
28
  export default Expression;
@@ -8,7 +8,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
8
8
  };
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  const Lexer_ts_1 = __importDefault(require("./Lexer.js"));
11
- const PromiseSync_ts_1 = __importDefault(require("./PromiseSync.js"));
12
11
  const Evaluator_ts_1 = __importDefault(require("./evaluator/Evaluator.js"));
13
12
  const Parser_ts_1 = __importDefault(require("./parser/Parser.js"));
14
13
  class Expression {
@@ -32,37 +31,16 @@ class Expression {
32
31
  return this;
33
32
  }
34
33
  /**
35
- * Asynchronously evaluates the expression within an optional context.
36
- * @param {Object} [context] A mapping of variables to values, which will be
37
- * made accessible to the Jexl expression when evaluating it
38
- * @returns {Promise<*>} resolves with the result of the evaluation.
39
- */
40
- eval(context = {}) {
41
- return this._eval(context, Promise);
42
- }
43
- /**
44
- * Synchronously evaluates the expression within an optional context.
34
+ * Evaluates the expression within an optional context.
45
35
  * @param {Object} [context] A mapping of variables to values, which will be
46
36
  * made accessible to the Jexl expression when evaluating it
47
37
  * @returns {*} the result of the evaluation.
48
38
  * @throws {*} on error
49
39
  */
50
- evalSync(context = {}) {
51
- const res = this._eval(context, PromiseSync_ts_1.default);
52
- if (res.error) {
53
- if (res.error instanceof Error) {
54
- throw res.error;
55
- }
56
- throw new Error(typeof res.error === 'string' ? res.error : JSON.stringify(res.error));
57
- }
58
- return res.value;
59
- }
60
- _eval(context, promise) {
61
- return promise.resolve().then(() => {
62
- const ast = this._getAst();
63
- const evaluator = new Evaluator_ts_1.default(this._grammar, context, undefined, promise);
64
- return evaluator.eval(ast);
65
- });
40
+ eval(context = {}) {
41
+ const ast = this._getAst();
42
+ const evaluator = new Evaluator_ts_1.default(this._grammar, context);
43
+ return evaluator.eval(ast);
66
44
  }
67
45
  _getAst() {
68
46
  if (!this._ast) {
@@ -1 +1 @@
1
- {"version":3,"file":"Expression.js","sourceRoot":"","sources":["../src/Expression.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;AAEH,0DAA8B;AAC9B,sEAA0C;AAC1C,4EAAgD;AAChD,mEAAuC;AAWvC,MAAM,UAAU;IAKd,YAAY,OAAgB,EAAE,OAAe;QAC3C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;QACvB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAED;;;;;OAKG;IACH,OAAO;QACL,MAAM,KAAK,GAAG,IAAI,kBAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACtC,MAAM,MAAM,GAAG,IAAI,mBAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;QAC/C,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAC5C,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;QACxB,IAAI,CAAC,IAAI,GA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-2,7 +2,6 @@ import Expression from './Expression.ts';
2
2
  interface Grammar {
3
3
  elements: Record<string, any>;
4
4
  functions: Record<string, (...args: any[]) => any>;
5
- transforms: Record<string, (val: any, ...args: any[]) => any>;
6
5
  }
7
6
  /**
8
7
  * Jexl is the Javascript Expression Language, capable of parsing and
@@ -26,13 +25,11 @@ declare class Jexl {
26
25
  * @param {number} precedence The operator's precedence
27
26
  * @param {function} fn A function to run to calculate the result. The function
28
27
  * will be called with two arguments: left and right, denoting the values
29
- * on either side of the operator. It should return either the resulting
30
- * value, or a Promise that resolves with the resulting value.
28
+ * on either side of the operator. It should return the resulting value.
31
29
  * @param {boolean} [manualEval] If true, the `left` and `right` arguments
32
30
  * will be wrapped in objects with an `eval` function. Calling
33
- * left.eval() or right.eval() will return a promise that resolves to
34
- * that operand's actual value. This is useful to conditionally evaluate
35
- * operands.
31
+ * left.eval() or right.eval() will return that operand's actual value.
32
+ * This is useful to conditionally evaluate operands.
36
33
  */
37
34
  addBinaryOp(operator: string, precedence: number, fn: (left: any, right: any) => any, manualEval?: boolean): void;
38
35
  /**
@@ -57,26 +54,9 @@ declare class Jexl {
57
54
  * @param {string} operator The operator string to be added
58
55
  * @param {function} fn A function to run to calculate the result. The function
59
56
  * will be called with one argument: the literal value to the right of the
60
- * operator. It should return either the resulting value, or a Promise
61
- * that resolves with the resulting value.
57
+ * operator. It should return the resulting value.
62
58
  */
63
59
  addUnaryOp(operator: string, fn: (right: any) => any): void;
64
- /**
65
- * Adds or replaces a transform function in this Jexl instance.
66
- * @param {string} name The name of the transform function, as it will be used
67
- * within Jexl expressions
68
- * @param {function} fn The function to be executed when this transform is
69
- * invoked. It will be provided with at least one argument:
70
- * - {*} value: The value to be transformed
71
- * - {...*} args: The arguments for this transform
72
- */
73
- addTransform(name: string, fn: (val: any, ...args: any[]) => any): void;
74
- /**
75
- * Syntactic sugar for calling {@link #addTransform} repeatedly. This function
76
- * accepts a map of one or more transform names to their transform function.
77
- * @param {{}} map A map of transform names to transform functions
78
- */
79
- addTransforms(map: Record<string, (val: any, ...args: any[]) => any>): void;
80
60
  /**
81
61
  * Creates an Expression object from the given Jexl expression string, and
82
62
  * immediately compiles it. The returned Expression object can then be
@@ -100,28 +80,14 @@ declare class Jexl {
100
80
  */
101
81
  getFunction(name: string): (...args: any[]) => any;
102
82
  /**
103
- * Retrieves a previously set transform function.
104
- * @param {string} name The name of the transform function
105
- * @returns {function} The transform function
106
- */
107
- getTransform(name: string): (val: any, ...args: any[]) => any;
108
- /**
109
- * Asynchronously evaluates a Jexl string within an optional context.
110
- * @param {string} expression The Jexl expression to be evaluated
111
- * @param {Object} [context] A mapping of variables to values, which will be
112
- * made accessible to the Jexl expression when evaluating it
113
- * @returns {Promise<*>} resolves with the result of the evaluation.
114
- */
115
- eval(expression: string, context?: {}): Promise<any> | import("./PromiseSync.ts").default<any>;
116
- /**
117
- * Synchronously evaluates a Jexl string within an optional context.
83
+ * Evaluates a Jexl string within an optional context.
118
84
  * @param {string} expression The Jexl expression to be evaluated
119
85
  * @param {Object} [context] A mapping of variables to values, which will be
120
86
  * made accessible to the Jexl expression when evaluating it
121
87
  * @returns {*} the result of the evaluation.
122
88
  * @throws {*} on error
123
89
  */
124
- evalSync(expression: string, context?: {}): unknown;
90
+ eval(expression: string, context?: {}): any;
125
91
  /**
126
92
  * A JavaScript template literal to allow expressions to be defined by the
127
93
  * syntax: expr`40 + 2`
package/dist/Jexl.js CHANGED
@@ -34,13 +34,11 @@ class Jexl {
34
34
  * @param {number} precedence The operator's precedence
35
35
  * @param {function} fn A function to run to calculate the result. The function
36
36
  * will be called with two arguments: left and right, denoting the values
37
- * on either side of the operator. It should return either the resulting
38
- * value, or a Promise that resolves with the resulting value.
37
+ * on either side of the operator. It should return the resulting value.
39
38
  * @param {boolean} [manualEval] If true, the `left` and `right` arguments
40
39
  * will be wrapped in objects with an `eval` function. Calling
41
- * left.eval() or right.eval() will return a promise that resolves to
42
- * that operand's actual value. This is useful to conditionally evaluate
43
- * operands.
40
+ * left.eval() or right.eval() will return that operand's actual value.
41
+ * This is useful to conditionally evaluate operands.
44
42
  */
45
43
  addBinaryOp(operator, precedence, fn, manualEval) {
46
44
  this._addGrammarElement(operator, {
@@ -75,8 +73,7 @@ class Jexl {
75
73
  * @param {string} operator The operator string to be added
76
74
  * @param {function} fn A function to run to calculate the result. The function
77
75
  * will be called with one argument: the literal value to the right of the
78
- * operator. It should return either the resulting value, or a Promise
79
- * that resolves with the resulting value.
76
+ * operator. It should return the resulting value.
80
77
  */
81
78
  addUnaryOp(operator, fn) {
82
79
  this._addGrammarElement(operator, {
@@ -85,26 +82,6 @@ class Jexl {
85
82
  eval: fn
86
83
  });
87
84
  }
88
- /**
89
- * Adds or replaces a transform function in this Jexl instance.
90
- * @param {string} name The name of the transform function, as it will be used
91
- * within Jexl expressions
92
- * @param {function} fn The function to be executed when this transform is
93
- * invoked. It will be provided with at least one argument:
94
- * - {*} value: The value to be transformed
95
- * - {...*} args: The arguments for this transform
96
- */
97
- addTransform(name, fn) {
98
- this._grammar.transforms[name] = fn;
99
- }
100
- /**
101
- * Syntactic sugar for calling {@link #addTransform} repeatedly. This function
102
- * accepts a map of one or more transform names to their transform function.
103
- * @param {{}} map A map of transform names to transform functions
104
- */
105
- addTransforms(map) {
106
- Object.assign(this._grammar.transforms, map);
107
- }
108
85
  /**
109
86
  * Creates an Expression object from the given Jexl expression string, and
110
87
  * immediately compiles it. The returned Expression object can then be
@@ -135,35 +112,16 @@ class Jexl {
135
112
  return this._grammar.functions[name];
136
113
  }
137
114
  /**
138
- * Retrieves a previously set transform function.
139
- * @param {string} name The name of the transform function
140
- * @returns {function} The transform function
141
- */
142
- getTransform(name) {
143
- return this._grammar.transforms[name];
144
- }
145
- /**
146
- * Asynchronously evaluates a Jexl string within an optional context.
147
- * @param {string} expression The Jexl expression to be evaluated
148
- * @param {Object} [context] A mapping of variables to values, which will be
149
- * made accessible to the Jexl expression when evaluating it
150
- * @returns {Promise<*>} resolves with the result of the evaluation.
151
- */
152
- eval(expression, context = {}) {
153
- const exprObj = this.createExpression(expression);
154
- return exprObj.eval(context);
155
- }
156
- /**
157
- * Synchronously evaluates a Jexl string within an optional context.
115
+ * Evaluates a Jexl string within an optional context.
158
116
  * @param {string} expression The Jexl expression to be evaluated
159
117
  * @param {Object} [context] A mapping of variables to values, which will be
160
118
  * made accessible to the Jexl expression when evaluating it
161
119
  * @returns {*} the result of the evaluation.
162
120
  * @throws {*} on error
163
121
  */
164
- evalSync(expression, context = {}) {
122
+ eval(expression, context = {}) {
165
123
  const exprObj = this.createExpression(expression);
166
- return exprObj.evalSync(context);
124
+ return exprObj.eval(context);
167
125
  }
168
126
  /**
169
127
  * A JavaScript template literal to allow expressions to be defined by the
package/dist/Jexl.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Jexl.js","sourceRoot":"","sources":["../src/Jexl.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,oEAAwC;AACxC,6CAAyC;AAQzC;;;;;GAKG;AACH,MAAM,IAAI;IAGR;QACE,IAAI,CAAC,QAAQ,GAAG,IAAA,uBAAU,GAAE,CAAA;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAClC,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,WAAW,CACT,QAAgB,EAChB,UAAkB,EAClB,EAAkC,EAClC,UAAoB;QAEpB,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE;YAChC,IAAI,EAAE,UAAU;YAChB,UAAU,EAAE,UAAU;YACtB,CAAC,UAAU,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE;SAC3C,CAAC,CAAA;IACJ,CAAC;IAED;;;;;;;OAOG;IACH,WAAW,CAAC,IAAY,EAAE,EAA2B;QACnD,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,CAAA;I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,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,EAAE,CAAC;YAClE,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;QAC1D,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACH,kBAAkB,CAAC,GAAW,EAAE,GAAQ;QACtC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,GAAG,CAAA;IACnC,CAAC;CACF;AAIQ,oBAAI;AAFb,MAAM,YAAY,GAAG,IAAI,IAAI,EAAE,CAAA;AAC/B,kBAAe,YAAY,CAAA"}
@@ -3,7 +3,6 @@ interface Grammar {
3
3
  elements: Record<string, any>;
4
4
  [key: string]: any;
5
5
  }
6
- type PromiseConstructor = typeof Promise | any;
7
6
  /**
8
7
  * The Evaluator takes a Jexl expression tree as generated by the
9
8
  * {@link Parser} and calculates its value within a given context. The
@@ -15,78 +14,38 @@ type PromiseConstructor = typeof Promise | any;
15
14
  * @param {{}} grammar A grammar object against which to evaluate the expression
16
15
  * tree
17
16
  * @param {{}} [context] A map of variable keys to their values. This will be
18
- * accessed to resolve the value of each non-relative identifier. Any
19
- * Promise values will be passed to the expression as their resolved
20
- * value.
17
+ * accessed to resolve the value of each non-relative identifier.
21
18
  * @param {{}|Array<{}|Array>} [relativeContext] A map or array to be accessed
22
19
  * to resolve the value of a relative identifier.
23
- * @param {function} promise A constructor for the Promise class to be used;
24
- * probably either Promise or PromiseSync.
25
20
  */
26
21
  declare class Evaluator {
27
22
  _grammar: Grammar;
28
23
  _context: any;
29
24
  _relContext: any;
30
- Promise: PromiseConstructor;
31
- constructor(grammar: Grammar, context?: any, relativeContext?: any, promise?: PromiseConstructor);
25
+ constructor(grammar: Grammar, context?: any, relativeContext?: any);
32
26
  /**
33
27
  * Evaluates an expression tree within the configured context.
34
28
  * @param {{}} ast An expression tree object
35
- * @returns {Promise<*>} resolves with the resulting value of the expression.
29
+ * @returns {*} the resulting value of the expression.
36
30
  */
37
31
  eval(ast: AstNode): any;
38
32
  /**
39
- * Simultaneously evaluates each expression within an array, and delivers the
40
- * response as an array with the resulting values at the same indexes as their
41
- * originating expressions.
33
+ * Evaluates each expression within an array, and delivers the response as an
34
+ * array with the resulting values at the same indexes as their originating
35
+ * expressions.
42
36
  * @param {Array<string>} arr An array of expression strings to be evaluated
43
- * @returns {Promise<Array<{}>>} resolves with the result array
37
+ * @returns {Array<{}>} the result array
44
38
  */
45
- evalArray(arr: AstNode[]): any;
39
+ evalArray(arr: AstNode[]): any[];
46
40
  /**
47
- * Simultaneously evaluates each expression within a map, and delivers the
48
- * response as a map with the same keys, but with the evaluated result for each
49
- * as their value.
41
+ * Evaluates each expression within a map, and delivers the response as a map
42
+ * with the same keys, but with the evaluated result for each as their value.
50
43
  * @param {{}} map A map of expression names to expression trees to be
51
44
  * evaluated
52
- * @returns {Promise<{}>} resolves with the result map.
45
+ * @returns {{}} the result map.
53
46
  */
54
- evalMap(map: Record<string, AstNode>): any;
55
- /**
56
- * Applies a filter expression with relative identifier elements to a subject.
57
- * The intent is for the subject to be an array of subjects that will be
58
- * individually used as the relative context against the provided expression
59
- * tree. Only the elements whose expressions result in a truthy value will be
60
- * included in the resulting array.
61
- *
62
- * If the subject is not an array of values, it will be converted to a single-
63
- * element array before running the filter.
64
- * @param {*} subject The value to be filtered usually an array. If this value is
65
- * not an array, it will be converted to an array with this value as the
66
- * only element.
67
- * @param {{}} expr The expression tree to run against each subject. If the
68
- * tree evaluates to a truthy result, then the value will be included in
69
- * the returned array otherwise, it will be eliminated.
70
- * @returns {Promise<Array>} resolves with an array of values that passed the
71
- * expression filter.
72
- * @private
73
- */
74
- _filterRelative(subject: any, expr: AstNode): any;
75
- /**
76
- * Applies a static filter expression to a subject value. If the filter
77
- * expression evaluates to boolean true, the subject is returned if false,
78
- * undefined.
79
- *
80
- * For any other resulting value of the expression, this function will attempt
81
- * to respond with the property at that name or index of the subject.
82
- * @param {*} subject The value to be filtered. Usually an Array (for which
83
- * the expression would generally resolve to a numeric index) or an
84
- * Object (for which the expression would generally resolve to a string
85
- * indicating a property name)
86
- * @param {{}} expr The expression tree to run against the subject
87
- * @returns {Promise<*>} resolves with the value of the drill-down.
88
- * @private
89
- */
90
- _filterStatic(subject: any, expr: AstNode): any;
47
+ evalMap(map: Record<string, AstNode>): {
48
+ [k: string]: any;
49
+ };
91
50
  }
92
51
  export default Evaluator;