babel-helper-mark-eval-scopes
Advanced tools
Comparing version 0.3.0-alpha.0f04ec28 to 0.3.0-alpha.169f8743
"use strict"; | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } | ||
const EVAL_SCOPE_MARKER = Symbol("evalInScope"); | ||
var EVAL_SCOPE_MARKER = Symbol("evalInScope"); | ||
module.exports = { | ||
@@ -16,6 +14,6 @@ EVAL_SCOPE_MARKER, | ||
function getEvalScopes(path) { | ||
var evalScopes = new Set(); | ||
const evalScopes = new Set(); | ||
function add(scope) { | ||
var evalScope = scope; | ||
let evalScope = scope; | ||
do { | ||
@@ -28,3 +26,3 @@ evalScopes.add(evalScope); | ||
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); | ||
[].concat(_toConsumableArray(evalScopes)).forEach(function (scope) { | ||
function markEvalScopes(path, key = EVAL_SCOPE_MARKER) { | ||
const evalScopes = getEvalScopes(path); | ||
[...evalScopes].forEach(scope => { | ||
scope[key] = true; | ||
@@ -50,11 +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)) { | ||
@@ -61,0 +53,0 @@ markEvalScopes(scope, key); |
{ | ||
"name": "babel-helper-mark-eval-scopes", | ||
"version": "0.3.0-alpha.0f04ec28", | ||
"version": "0.3.0-alpha.169f8743", | ||
"description": "Mark scopes for deopt which contain a direct eval call", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
3933
128