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

babel-plugin-check-es2015-constants

Package Overview
Dependencies
Maintainers
4
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-check-es2015-constants - npm Package Compare versions

Comparing version 7.0.0-alpha.15 to 7.0.0-alpha.16

31

lib/index.js

@@ -6,4 +6,9 @@ "use strict";

exports.default = function (_ref) {
var messages = _ref.messages;
var messages = _ref.messages,
t = _ref.types;
function statementBeforeExpression(statement, expression) {
return t.sequenceExpression([t.callExpression(t.functionExpression(null, [], t.blockStatement([statement])), []), expression]);
}
return {

@@ -17,18 +22,16 @@ visitor: {

if (binding.kind !== "const" && binding.kind !== "module") continue;
var _arr = binding.constantViolations;
for (var _iterator = binding.constantViolations, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref3;
for (var _i = 0; _i < _arr.length; _i++) {
var violation = _arr[_i];
var throwNode = t.throwStatement(t.newExpression(t.identifier("Error"), [t.stringLiteral(messages.get("readOnly", name))]));
if (_isArray) {
if (_i >= _iterator.length) break;
_ref3 = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref3 = _i.value;
if (violation.isAssignmentExpression()) {
violation.get("right").replaceWith(statementBeforeExpression(throwNode, violation.get("right").node));
} else if (violation.parentPath.isUpdateExpression()) {
violation.parentPath.replaceWith(statementBeforeExpression(throwNode, violation.parent));
} else if (violation.parentPath.isForXStatement()) {
violation.parentPath.ensureBlock();
violation.parentPath.node.body.body.unshift(throwNode);
}
var violation = _ref3;
throw violation.buildCodeFrameError(messages.get("readOnly", name));
}

@@ -35,0 +38,0 @@ }

{
"name": "babel-plugin-check-es2015-constants",
"version": "7.0.0-alpha.15",
"version": "7.0.0-alpha.16",
"description": "Compile ES2015 constants to ES5",

@@ -12,4 +12,4 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-check-es2015-constants",

"devDependencies": {
"babel-helper-plugin-test-runner": "7.0.0-alpha.15"
"babel-helper-plugin-test-runner": "7.0.0-alpha.16"
}
}
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