@cnrs/hel 0.5.1 → 0.5.2
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.
- package/package.json +2 -2
- package/src/str2fun.js +3 -2
package/package.json
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"https://medium.com/sapioit/why-having-3-numbers-in-the-version-name-is-bad-92fc1f6bc73c",
|
|
29
29
|
"https://gist.github.com/jashkenas/cbd2b088e20279ae2c8e"
|
|
30
30
|
],
|
|
31
|
-
"version": "0.5.
|
|
31
|
+
"version": "0.5.2",
|
|
32
32
|
"keywords": [
|
|
33
33
|
"hera",
|
|
34
34
|
"hecate",
|
|
@@ -144,4 +144,4 @@
|
|
|
144
144
|
"lint": "exec eslint \"src/**/*.js\"",
|
|
145
145
|
"doc:html": "./node_modules/jsdoc/jsdoc.js -c .jsdoc.conf.json"
|
|
146
146
|
}
|
|
147
|
-
}
|
|
147
|
+
}
|
package/src/str2fun.js
CHANGED
|
@@ -96,7 +96,8 @@ class StringToFunctionVisitor extends CstVisitor {
|
|
|
96
96
|
if (context.attribute) return this.visit(context.attribute);
|
|
97
97
|
if (context.property) return this.visit(context.property);
|
|
98
98
|
if (context.Integer) return parseInt(context.Integer[0].image);
|
|
99
|
-
|
|
99
|
+
const value = context.String[0].image;
|
|
100
|
+
return value.substring(1, value.length-1); // remove surrounding quotes
|
|
100
101
|
}
|
|
101
102
|
|
|
102
103
|
relationalOperator(context) {
|
|
@@ -129,7 +130,7 @@ class StringToFunctionVisitor extends CstVisitor {
|
|
|
129
130
|
const visitor = new StringToFunctionVisitor(); // this is stateless, so Singleton
|
|
130
131
|
|
|
131
132
|
export function toFunction(input) {
|
|
132
|
-
if (!input) return (
|
|
133
|
+
if (!input) return () => true; // accepts ""
|
|
133
134
|
const result = tokenize(input);
|
|
134
135
|
parser.input = result.tokens; // resets the parser's internal state
|
|
135
136
|
const cst = parser.statement(); // semantics actions are now defined
|