Comparing version 1.2.0 to 1.3.0
@@ -157,2 +157,3 @@ 'use strict'; | ||
* @property {boolean} [strict=false] - whether to expect strict data types out of our FEEL expression, e.g. boolean for conditionals | ||
* @property {function} [sanitizer] - function to sanitize individual FEEL evaluation results | ||
*/ | ||
@@ -170,4 +171,5 @@ | ||
debug = false, | ||
strict = false, | ||
buildDebugString = (e) => `{{ ${e.message.toLowerCase()} }}`, | ||
strict = false | ||
sanitizer | ||
} = options; | ||
@@ -179,3 +181,3 @@ | ||
const evaluateNode = buildNodeEvaluator(debug, buildDebugString, strict); | ||
const evaluateNode = buildNodeEvaluator({ debug, strict, buildDebugString, sanitizer }); | ||
@@ -186,4 +188,15 @@ return evaluateNode(simpleTreeRoot, enhanceContext(context, null)); | ||
const buildNodeEvaluator = (debug, buildDebugString, strict) => { | ||
/** | ||
* @param {EvaluationOptions} options - options to configure the evaluation | ||
* @return {function} a function that takes a node and context and evaluates it | ||
*/ | ||
const buildNodeEvaluator = (options) => { | ||
const { | ||
debug, | ||
strict, | ||
buildDebugString, | ||
sanitizer | ||
} = options; | ||
const errorHandler = (error) => { | ||
@@ -209,3 +222,4 @@ | ||
try { | ||
return feelin.evaluate(`string(${feel})`, context); | ||
const result = feelin.evaluate(`string(${feel})`, context); | ||
return sanitizer ? sanitizer(result) : result; | ||
} | ||
@@ -225,3 +239,4 @@ catch { | ||
try { | ||
return feelin.evaluate(`string(${feel})`, context); | ||
const result = feelin.evaluate(`string(${feel})`, context); | ||
return sanitizer ? sanitizer(result) : result; | ||
} | ||
@@ -228,0 +243,0 @@ catch (e) { |
{ | ||
"name": "feelers", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "FEELers grammar and editor for the Lezer parser system.", | ||
@@ -39,3 +39,3 @@ "main": "dist/index.js", | ||
"@bpmn-io/cm-theme": "^0.1.0-alpha.2", | ||
"@bpmn-io/feel-lint": "^1.1.0", | ||
"@bpmn-io/feel-lint": "^1.2.0", | ||
"@codemirror/autocomplete": "^6.10.1", | ||
@@ -51,4 +51,4 @@ "@codemirror/commands": "^6.3.0", | ||
"@lezer/markdown": "^1.1.0", | ||
"feelin": "^2.3.0", | ||
"lezer-feel": "^1.2.0", | ||
"feelin": "^3.0.0", | ||
"lezer-feel": "^1.2.4", | ||
"min-dom": "^4.1.0" | ||
@@ -55,0 +55,0 @@ }, |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
64648
1453
+ Addedfeelin@3.2.0(transitive)
- Removedfeelin@2.3.0(transitive)
Updated@bpmn-io/feel-lint@^1.2.0
Updatedfeelin@^3.0.0
Updatedlezer-feel@^1.2.4