Skip to content

Commit f55b4bf

Browse files
committed
2.0.3
1 parent d7a5322 commit f55b4bf

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

lib/Expression.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,16 @@ class Expression extends ExpressionSync {
2626
return Expression.FAIL;
2727
}
2828

29-
const val = () => typeof right === 'function' ? right() : right;
29+
const s = v => {
30+
if (typeof v === 'symbol') {
31+
this.state.fail = true;
32+
return;
33+
}
34+
35+
return v;
36+
};
37+
38+
const val = () => s(typeof right === 'function' ? right() : right);
3039

3140
switch (operator) {
3241
case 'in': {

lib/ExpressionSync.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,17 @@ class ExpressionSync {
121121
return ExpressionSync.FAIL;
122122
}
123123

124+
const s = v => {
125+
if (typeof v === 'symbol') {
126+
this.state.fail = true;
127+
return;
128+
}
129+
130+
return v;
131+
};
132+
124133
// only lazily evaluate "right" when necessary
125-
const val = () => typeof right === 'function' ? right() : right;
134+
const val = () => s(typeof right === 'function' ? right() : right);
126135

127136
if (operator === 'in') {
128137
const value = val();

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "eval-estree-expression",
33
"description": "Safely evaluate JavaScript (estree) expressions, sync and async.",
4-
"version": "2.0.2",
4+
"version": "2.0.3",
55
"license": "MIT",
66
"homepage": "https://github.com/jonschlinkert/eval-estree-expression",
77
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",

0 commit comments

Comments
 (0)