Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eval5

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eval5 - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

2

esm/interpreter/main.d.ts

@@ -53,3 +53,3 @@ import { MessageItem } from "./messages";

protected execEndTime: number;
static readonly version = "1.1.0";
static readonly version = "1.1.1";
static readonly eval: symbol;

@@ -56,0 +56,0 @@ static readonly Function: symbol;

@@ -1391,3 +1391,3 @@ import _construct from "@babel/runtime/helpers/construct";

var ret = _this20.setValue(bodyClosure()); // Important: never return Break or Continue!
var ret = _this20.setValue(bodyClosure()); // notice: never return Break or Continue!

@@ -1445,4 +1445,8 @@

_proto.throwStatementHandler = function throwStatementHandler(node) {
var _this22 = this;
var argumentClosure = this.createClosure(node.argument);
return function () {
_this22.setValue(undefined);
throw argumentClosure();

@@ -1454,3 +1458,3 @@ };

_proto.tryStatementHandler = function tryStatementHandler(node) {
var _this22 = this;
var _this23 = this;

@@ -1461,9 +1465,9 @@ var blockClosure = this.createClosure(node.block);

return function () {
var currentScope = _this22.getCurrentScope();
var currentScope = _this23.getCurrentScope();
var currentContext = _this22.getCurrentContext();
var currentContext = _this23.getCurrentContext();
var labelStack = currentScope.labelStack.concat([]);
var callStack = _this22.callStack.concat([]);
var callStack = _this23.callStack.concat([]);

@@ -1475,6 +1479,6 @@ var result = EmptyStatementReturn;

var reset = function reset() {
_this22.setCurrentScope(currentScope); //reset scope
_this23.setCurrentScope(currentScope); //reset scope
_this22.setCurrentContext(currentContext); //reset context
_this23.setCurrentContext(currentContext); //reset context

@@ -1484,3 +1488,3 @@

_this22.callStack = callStack; //reset call stack
_this23.callStack = callStack; //reset call stack
};

@@ -1500,3 +1504,3 @@ /**

try {
result = _this22.setValue(blockClosure());
result = _this23.setValue(blockClosure());

@@ -1509,3 +1513,3 @@ if (result instanceof Return) {

if (_this22.isInterruptThrow(err)) {
if (_this23.isInterruptThrow(err)) {
throw err;

@@ -1516,3 +1520,3 @@ }

try {
result = _this22.setValue(handlerClosure(err));
result = _this23.setValue(handlerClosure(err));

@@ -1525,3 +1529,3 @@ if (result instanceof Return) {

if (_this22.isInterruptThrow(err)) {
if (_this23.isInterruptThrow(err)) {
throw err;

@@ -1549,3 +1553,3 @@ } // save catch throw error

if (_this22.isInterruptThrow(err)) {
if (_this23.isInterruptThrow(err)) {
throw err;

@@ -1575,3 +1579,3 @@ } // save finally throw error

_proto.catchClauseHandler = function catchClauseHandler(node) {
var _this23 = this;
var _this24 = this;

@@ -1583,3 +1587,3 @@ var paramNameGetter = this.createParamNameGetter(node.param);

var currentScope = _this23.getCurrentScope();
var currentScope = _this24.getCurrentScope();

@@ -1622,7 +1626,7 @@ var scopeData = currentScope.data; // get param name "e"

_proto.switchStatementHandler = function switchStatementHandler(node) {
var _this24 = this;
var _this25 = this;
var discriminantClosure = this.createClosure(node.discriminant);
var caseClosures = node.cases.map(function (item) {
return _this24.switchCaseHandler(item);
return _this25.switchCaseHandler(item);
});

@@ -1646,3 +1650,3 @@ return function () {

match = true;
ret = _this24.setValue(item.bodyClosure()); // notice: never return Break!
ret = _this25.setValue(item.bodyClosure()); // notice: never return Break!

@@ -1664,3 +1668,3 @@ if (ret === EmptyStatementReturn) continue;

if (!match && defaultCase) {
ret = _this24.setValue(defaultCase.bodyClosure());
ret = _this25.setValue(defaultCase.bodyClosure());
var isEBC = ret === EmptyStatementReturn || ret === Break || ret === Continue; // notice: never return Break or Continue!

@@ -1695,3 +1699,3 @@

_proto.labeledStatementHandler = function labeledStatementHandler(node) {
var _this25 = this;
var _this26 = this;

@@ -1703,3 +1707,3 @@ var labelName = node.label.name;

var currentScope = _this25.getCurrentScope();
var currentScope = _this26.getCurrentScope();

@@ -1762,3 +1766,3 @@ currentScope.labelStack.push(labelName);

_proto.createObjectGetter = function createObjectGetter(node) {
var _this26 = this;
var _this27 = this;

@@ -1768,3 +1772,3 @@ switch (node.type) {

return function () {
return _this26.getScopeDataFromName(node.name, _this26.getCurrentScope());
return _this27.getScopeDataFromName(node.name, _this27.getCurrentScope());
};

@@ -1868,3 +1872,3 @@

}();
Interpreter.version = "1.1.0";
Interpreter.version = "1.1.1";
Interpreter.eval = IEval;

@@ -1871,0 +1875,0 @@ Interpreter.Function = IFunction; // alert.call(rootContext, 1);

@@ -53,3 +53,3 @@ import { MessageItem } from "./messages";

protected execEndTime: number;
static readonly version = "1.1.0";
static readonly version = "1.1.1";
static readonly eval: symbol;

@@ -56,0 +56,0 @@ static readonly Function: symbol;

@@ -1402,3 +1402,3 @@ "use strict";

var ret = _this20.setValue(bodyClosure()); // Important: never return Break or Continue!
var ret = _this20.setValue(bodyClosure()); // notice: never return Break or Continue!

@@ -1456,4 +1456,8 @@

_proto.throwStatementHandler = function throwStatementHandler(node) {
var _this22 = this;
var argumentClosure = this.createClosure(node.argument);
return function () {
_this22.setValue(undefined);
throw argumentClosure();

@@ -1465,3 +1469,3 @@ };

_proto.tryStatementHandler = function tryStatementHandler(node) {
var _this22 = this;
var _this23 = this;

@@ -1472,9 +1476,9 @@ var blockClosure = this.createClosure(node.block);

return function () {
var currentScope = _this22.getCurrentScope();
var currentScope = _this23.getCurrentScope();
var currentContext = _this22.getCurrentContext();
var currentContext = _this23.getCurrentContext();
var labelStack = currentScope.labelStack.concat([]);
var callStack = _this22.callStack.concat([]);
var callStack = _this23.callStack.concat([]);

@@ -1486,6 +1490,6 @@ var result = EmptyStatementReturn;

var reset = function reset() {
_this22.setCurrentScope(currentScope); //reset scope
_this23.setCurrentScope(currentScope); //reset scope
_this22.setCurrentContext(currentContext); //reset context
_this23.setCurrentContext(currentContext); //reset context

@@ -1495,3 +1499,3 @@

_this22.callStack = callStack; //reset call stack
_this23.callStack = callStack; //reset call stack
};

@@ -1511,3 +1515,3 @@ /**

try {
result = _this22.setValue(blockClosure());
result = _this23.setValue(blockClosure());

@@ -1520,3 +1524,3 @@ if (result instanceof Return) {

if (_this22.isInterruptThrow(err)) {
if (_this23.isInterruptThrow(err)) {
throw err;

@@ -1527,3 +1531,3 @@ }

try {
result = _this22.setValue(handlerClosure(err));
result = _this23.setValue(handlerClosure(err));

@@ -1536,3 +1540,3 @@ if (result instanceof Return) {

if (_this22.isInterruptThrow(err)) {
if (_this23.isInterruptThrow(err)) {
throw err;

@@ -1560,3 +1564,3 @@ } // save catch throw error

if (_this22.isInterruptThrow(err)) {
if (_this23.isInterruptThrow(err)) {
throw err;

@@ -1586,3 +1590,3 @@ } // save finally throw error

_proto.catchClauseHandler = function catchClauseHandler(node) {
var _this23 = this;
var _this24 = this;

@@ -1594,3 +1598,3 @@ var paramNameGetter = this.createParamNameGetter(node.param);

var currentScope = _this23.getCurrentScope();
var currentScope = _this24.getCurrentScope();

@@ -1633,7 +1637,7 @@ var scopeData = currentScope.data; // get param name "e"

_proto.switchStatementHandler = function switchStatementHandler(node) {
var _this24 = this;
var _this25 = this;
var discriminantClosure = this.createClosure(node.discriminant);
var caseClosures = node.cases.map(function (item) {
return _this24.switchCaseHandler(item);
return _this25.switchCaseHandler(item);
});

@@ -1657,3 +1661,3 @@ return function () {

match = true;
ret = _this24.setValue(item.bodyClosure()); // notice: never return Break!
ret = _this25.setValue(item.bodyClosure()); // notice: never return Break!

@@ -1675,3 +1679,3 @@ if (ret === EmptyStatementReturn) continue;

if (!match && defaultCase) {
ret = _this24.setValue(defaultCase.bodyClosure());
ret = _this25.setValue(defaultCase.bodyClosure());
var isEBC = ret === EmptyStatementReturn || ret === Break || ret === Continue; // notice: never return Break or Continue!

@@ -1706,3 +1710,3 @@

_proto.labeledStatementHandler = function labeledStatementHandler(node) {
var _this25 = this;
var _this26 = this;

@@ -1714,3 +1718,3 @@ var labelName = node.label.name;

var currentScope = _this25.getCurrentScope();
var currentScope = _this26.getCurrentScope();

@@ -1773,3 +1777,3 @@ currentScope.labelStack.push(labelName);

_proto.createObjectGetter = function createObjectGetter(node) {
var _this26 = this;
var _this27 = this;

@@ -1779,3 +1783,3 @@ switch (node.type) {

return function () {
return _this26.getScopeDataFromName(node.name, _this26.getCurrentScope());
return _this27.getScopeDataFromName(node.name, _this27.getCurrentScope());
};

@@ -1881,3 +1885,3 @@

exports.Interpreter = Interpreter;
Interpreter.version = "1.1.0";
Interpreter.version = "1.1.1";
Interpreter.eval = IEval;

@@ -1884,0 +1888,0 @@ Interpreter.Function = IFunction; // alert.call(rootContext, 1);

{
"name": "eval5",
"version": "1.1.0",
"version": "1.1.1",
"description": "A JavaScript interpreter, written completely in JavaScript",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -43,4 +43,8 @@ # eval5

VERSION
### static `global`
`object` 默认:`Object.create(null)`
设置默认作用域对象

@@ -57,2 +61,4 @@

`readonly`
替代原有的`eval`占位符

@@ -81,2 +87,4 @@

`readonly`
替代原有的`Function`占位符

@@ -83,0 +91,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc