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

babel-helper-mark-eval-scopes

Package Overview
Dependencies
Maintainers
7
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-helper-mark-eval-scopes - npm Package Compare versions

Comparing version 0.5.0-alpha.b5bafaeb to 0.5.0-alpha.bce578e2

25

lib/index.js
"use strict";
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
var EVAL_SCOPE_MARKER = Symbol("evalInScope");
const EVAL_SCOPE_MARKER = Symbol("evalInScope");
module.exports = {

@@ -15,6 +13,6 @@ EVAL_SCOPE_MARKER,

function getEvalScopes(path) {
var evalScopes = new Set();
const evalScopes = new Set();
function add(scope) {
var evalScope = scope;
let evalScope = scope;

@@ -28,3 +26,3 @@ do {

CallExpression(evalPath) {
var callee = evalPath.get("callee");
const callee = evalPath.get("callee");

@@ -40,7 +38,5 @@ if (callee.isIdentifier() && callee.node.name === "eval" && !callee.scope.getBinding("eval")) {

function markEvalScopes(path) {
var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : EVAL_SCOPE_MARKER;
var evalScopes = getEvalScopes(path);
_toConsumableArray(evalScopes).forEach(function (scope) {
function markEvalScopes(path, key = EVAL_SCOPE_MARKER) {
const evalScopes = getEvalScopes(path);
[...evalScopes].forEach(scope => {
scope[key] = true;

@@ -50,10 +46,7 @@ });

function isMarked(scope) {
var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : EVAL_SCOPE_MARKER;
function isMarked(scope, key = EVAL_SCOPE_MARKER) {
return Object.prototype.hasOwnProperty.call(scope, key);
}
function hasEval(scope) {
var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : EVAL_SCOPE_MARKER;
function hasEval(scope, key = EVAL_SCOPE_MARKER) {
if (!isMarked(scope, key)) {

@@ -60,0 +53,0 @@ markEvalScopes(scope, key);

{
"name": "babel-helper-mark-eval-scopes",
"version": "0.5.0-alpha.b5bafaeb",
"version": "0.5.0-alpha.bce578e2",
"description": "Mark scopes for deopt which contain a direct eval call",

@@ -5,0 +5,0 @@ "keywords": [

@@ -8,3 +8,3 @@ # babel-helper-mark-eval-scopes

```sh
npm install babel-helper-mark-eval-scopes
npm install babel-helper-mark-eval-scopes --save-dev
```
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