Skip to content

Commit 106d243

Browse files
authored
feat: add void operator (#244)
fixes: #239
1 parent 235b283 commit 106d243

30 files changed

+1648
-1516
lines changed

badges/tests-badge.svg

Lines changed: 1 addition & 1 deletion
Loading

dist/index-browser-esm.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@ class Plugins {
7575
* @param {PluginSetup} plugins.init The init function
7676
* @public
7777
*/
78-
register(...plugins) {
78+
register() {
79+
for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) {
80+
plugins[_key] = arguments[_key];
81+
}
7982
plugins.forEach(plugin => {
8083
if (typeof plugin !== 'object' || !plugin.name || !plugin.init) {
8184
throw new Error('Invalid JSEP plugin format');
@@ -1200,6 +1203,7 @@ const plugin = {
12001203
// register plugins
12011204
jsep.plugins.register(index, plugin);
12021205
jsep.addUnaryOp('typeof');
1206+
jsep.addUnaryOp('void');
12031207
jsep.addLiteral('null', null);
12041208
jsep.addLiteral('undefined', undefined);
12051209
const BLOCKED_PROTO_PROPERTIES = new Set(['constructor', '__proto__', '__defineGetter__', '__defineSetter__']);
@@ -1321,7 +1325,9 @@ const SafeEval = {
13211325
'~': a => ~SafeEval.evalAst(a, subs),
13221326
// eslint-disable-next-line no-implicit-coercion -- API
13231327
'+': a => +SafeEval.evalAst(a, subs),
1324-
typeof: a => typeof SafeEval.evalAst(a, subs)
1328+
typeof: a => typeof SafeEval.evalAst(a, subs),
1329+
// eslint-disable-next-line no-void, sonarjs/void-use -- feature
1330+
void: a => void SafeEval.evalAst(a, subs)
13251331
}[ast.operator](ast.argument);
13261332
return result;
13271333
},

dist/index-browser-esm.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index-browser-esm.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index-browser-umd.cjs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@
8181
* @param {PluginSetup} plugins.init The init function
8282
* @public
8383
*/
84-
register(...plugins) {
84+
register() {
85+
for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) {
86+
plugins[_key] = arguments[_key];
87+
}
8588
plugins.forEach(plugin => {
8689
if (typeof plugin !== 'object' || !plugin.name || !plugin.init) {
8790
throw new Error('Invalid JSEP plugin format');
@@ -1206,6 +1209,7 @@
12061209
// register plugins
12071210
jsep.plugins.register(index, plugin);
12081211
jsep.addUnaryOp('typeof');
1212+
jsep.addUnaryOp('void');
12091213
jsep.addLiteral('null', null);
12101214
jsep.addLiteral('undefined', undefined);
12111215
const BLOCKED_PROTO_PROPERTIES = new Set(['constructor', '__proto__', '__defineGetter__', '__defineSetter__']);
@@ -1327,7 +1331,9 @@
13271331
'~': a => ~SafeEval.evalAst(a, subs),
13281332
// eslint-disable-next-line no-implicit-coercion -- API
13291333
'+': a => +SafeEval.evalAst(a, subs),
1330-
typeof: a => typeof SafeEval.evalAst(a, subs)
1334+
typeof: a => typeof SafeEval.evalAst(a, subs),
1335+
// eslint-disable-next-line no-void, sonarjs/void-use -- feature
1336+
void: a => void SafeEval.evalAst(a, subs)
13311337
}[ast.operator](ast.argument);
13321338
return result;
13331339
},

dist/index-browser-umd.min.cjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

dist/index-browser-umd.min.cjs.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index-node-cjs.cjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1204,6 +1204,7 @@ const plugin = {
12041204
// register plugins
12051205
jsep.plugins.register(index, plugin);
12061206
jsep.addUnaryOp('typeof');
1207+
jsep.addUnaryOp('void');
12071208
jsep.addLiteral('null', null);
12081209
jsep.addLiteral('undefined', undefined);
12091210
const BLOCKED_PROTO_PROPERTIES = new Set(['constructor', '__proto__', '__defineGetter__', '__defineSetter__']);
@@ -1325,7 +1326,9 @@ const SafeEval = {
13251326
'~': a => ~SafeEval.evalAst(a, subs),
13261327
// eslint-disable-next-line no-implicit-coercion -- API
13271328
'+': a => +SafeEval.evalAst(a, subs),
1328-
typeof: a => typeof SafeEval.evalAst(a, subs)
1329+
typeof: a => typeof SafeEval.evalAst(a, subs),
1330+
// eslint-disable-next-line no-void, sonarjs/void-use -- feature
1331+
void: a => void SafeEval.evalAst(a, subs)
13291332
}[ast.operator](ast.argument);
13301333
return result;
13311334
},

dist/index-node-esm.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1202,6 +1202,7 @@ const plugin = {
12021202
// register plugins
12031203
jsep.plugins.register(index, plugin);
12041204
jsep.addUnaryOp('typeof');
1205+
jsep.addUnaryOp('void');
12051206
jsep.addLiteral('null', null);
12061207
jsep.addLiteral('undefined', undefined);
12071208
const BLOCKED_PROTO_PROPERTIES = new Set(['constructor', '__proto__', '__defineGetter__', '__defineSetter__']);
@@ -1323,7 +1324,9 @@ const SafeEval = {
13231324
'~': a => ~SafeEval.evalAst(a, subs),
13241325
// eslint-disable-next-line no-implicit-coercion -- API
13251326
'+': a => +SafeEval.evalAst(a, subs),
1326-
typeof: a => typeof SafeEval.evalAst(a, subs)
1327+
typeof: a => typeof SafeEval.evalAst(a, subs),
1328+
// eslint-disable-next-line no-void, sonarjs/void-use -- feature
1329+
void: a => void SafeEval.evalAst(a, subs)
13271330
}[ast.operator](ast.argument);
13281331
return result;
13291332
},

docs/ts/assets/hierarchy.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)