Skip to content

Commit

Permalink
feat: add typeof operator to safe script
Browse files Browse the repository at this point in the history
  • Loading branch information
80avin authored and brettz9 committed Oct 19, 2024
1 parent b70aa71 commit f119fe3
Show file tree
Hide file tree
Showing 29 changed files with 396 additions and 281 deletions.
2 changes: 1 addition & 1 deletion badges/coverage-badge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion badges/tests-badge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion dist/index-browser-esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -1200,6 +1200,7 @@ const plugin = {

// register plugins
jsep.plugins.register(index, plugin);
jsep.addUnaryOp('typeof');
const SafeEval = {
/**
* @param {jsep.Expression} ast
Expand Down Expand Up @@ -1318,7 +1319,8 @@ const SafeEval = {
'!': a => !SafeEval.evalAst(a, subs),
'~': a => ~SafeEval.evalAst(a, subs),
// eslint-disable-next-line no-implicit-coercion -- API
'+': a => +SafeEval.evalAst(a, subs)
'+': a => +SafeEval.evalAst(a, subs),
typeof: a => typeof SafeEval.evalAst(a, subs)
}[ast.operator](ast.argument);
return result;
},
Expand Down
2 changes: 1 addition & 1 deletion dist/index-browser-esm.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index-browser-esm.min.js.map

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion dist/index-browser-umd.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -1206,6 +1206,7 @@

// register plugins
jsep.plugins.register(index, plugin);
jsep.addUnaryOp('typeof');
const SafeEval = {
/**
* @param {jsep.Expression} ast
Expand Down Expand Up @@ -1324,7 +1325,8 @@
'!': a => !SafeEval.evalAst(a, subs),
'~': a => ~SafeEval.evalAst(a, subs),
// eslint-disable-next-line no-implicit-coercion -- API
'+': a => +SafeEval.evalAst(a, subs)
'+': a => +SafeEval.evalAst(a, subs),
typeof: a => typeof SafeEval.evalAst(a, subs)
}[ast.operator](ast.argument);
return result;
},
Expand Down
2 changes: 1 addition & 1 deletion dist/index-browser-umd.min.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index-browser-umd.min.cjs.map

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion dist/index-node-cjs.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -1201,6 +1201,7 @@ const plugin = {

// register plugins
jsep.plugins.register(index, plugin);
jsep.addUnaryOp('typeof');
const SafeEval = {
/**
* @param {jsep.Expression} ast
Expand Down Expand Up @@ -1319,7 +1320,8 @@ const SafeEval = {
'!': a => !SafeEval.evalAst(a, subs),
'~': a => ~SafeEval.evalAst(a, subs),
// eslint-disable-next-line no-implicit-coercion -- API
'+': a => +SafeEval.evalAst(a, subs)
'+': a => +SafeEval.evalAst(a, subs),
typeof: a => typeof SafeEval.evalAst(a, subs)
}[ast.operator](ast.argument);
return result;
},
Expand Down
4 changes: 3 additions & 1 deletion dist/index-node-esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -1199,6 +1199,7 @@ const plugin = {

// register plugins
jsep.plugins.register(index, plugin);
jsep.addUnaryOp('typeof');
const SafeEval = {
/**
* @param {jsep.Expression} ast
Expand Down Expand Up @@ -1317,7 +1318,8 @@ const SafeEval = {
'!': a => !SafeEval.evalAst(a, subs),
'~': a => ~SafeEval.evalAst(a, subs),
// eslint-disable-next-line no-implicit-coercion -- API
'+': a => +SafeEval.evalAst(a, subs)
'+': a => +SafeEval.evalAst(a, subs),
typeof: a => typeof SafeEval.evalAst(a, subs)
}[ast.operator](ast.argument);
return result;
},
Expand Down
Loading

0 comments on commit f119fe3

Please sign in to comment.