New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-minify-type-constructors

Package Overview
Dependencies
Maintainers
5
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-minify-type-constructors - npm Package Compare versions

Comparing version 0.3.0-alpha.cf9a0da2 to 0.3.0-alpha.d9c99d3f

48

lib/index.js
"use strict";
function replaceArray(t, path) {
var node = path.node;
const node = path.node;
// arguments is taken :(
var constructorArgs = path.get("arguments");
const constructorArgs = path.get("arguments");
if (t.isIdentifier(node.callee, { name: "Array" }) && !path.scope.getBinding("Array")) {

@@ -13,4 +13,4 @@ if (constructorArgs.length === 0) {

} else if (constructorArgs.length === 1) {
var arg = constructorArgs[0];
var result = arg.evaluate();
const arg = constructorArgs[0];
const result = arg.evaluate();

@@ -30,3 +30,3 @@ if (result.confident) {

} else {
var transformables = ["ArrayExpression", "ObjectExpression", "FunctionExpression", "ArrowFunctionExpression", "ClassExpression"];
const transformables = ["ArrayExpression", "ObjectExpression", "FunctionExpression", "ArrowFunctionExpression", "ClassExpression"];
if (transformables.indexOf(arg.node.type) !== -1) {

@@ -56,8 +56,8 @@ // Array([]), Array({})

function replaceObject(t, path) {
var node = path.node;
const node = path.node;
if (t.isIdentifier(node.callee, { name: "Object" }) && !path.scope.getBinding("Object")) {
var isVoid0 = require("babel-helper-is-void-0")(t);
var arg = node.arguments[0];
var binding = arg && t.isIdentifier(arg) && path.scope.getBinding(arg.name);
const isVoid0 = require("babel-helper-is-void-0")(t);
const arg = node.arguments[0];
const binding = arg && t.isIdentifier(arg) && path.scope.getBinding(arg.name);

@@ -92,15 +92,9 @@ // Object() -> {}

function defaults() {
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
_ref$boolean = _ref.boolean,
boolean = _ref$boolean === undefined ? true : _ref$boolean,
_ref$number = _ref.number,
number = _ref$number === undefined ? true : _ref$number,
_ref$string = _ref.string,
string = _ref$string === undefined ? true : _ref$string,
_ref$array = _ref.array,
array = _ref$array === undefined ? true : _ref$array,
_ref$object = _ref.object,
object = _ref$object === undefined ? true : _ref$object;
function defaults({
boolean = true,
number = true,
string = true,
array = true,
object = true
} = {}) {
return {

@@ -115,5 +109,3 @@ boolean,

module.exports = function (_ref2) {
var t = _ref2.types;
module.exports = function ({ types: t }) {
return {

@@ -123,5 +115,5 @@ name: "minify-type-constructors",

CallExpression(path) {
var node = path.node;
const node = path.node;
var opts = defaults(this.opts);
const opts = defaults(this.opts);

@@ -157,3 +149,3 @@ // Boolean(foo) -> !!foo

NewExpression(path) {
var opts = defaults(this.opts);
const opts = defaults(this.opts);

@@ -160,0 +152,0 @@ // new Array() -> []

{
"name": "babel-plugin-minify-type-constructors",
"version": "0.3.0-alpha.cf9a0da2",
"version": "0.3.0-alpha.d9c99d3f",
"description": "",

@@ -15,4 +15,4 @@ "keywords": [

"dependencies": {
"babel-helper-is-void-0": "^0.3.0-alpha.cf9a0da2"
"babel-helper-is-void-0": "^0.3.0-alpha.d9c99d3f"
}
}
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