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

@putout/operate

Package Overview
Dependencies
Maintainers
1
Versions
104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@putout/operate - npm Package Compare versions

Comparing version 8.9.0 to 8.9.1

lib/remove.js

53

lib/operate.js

@@ -21,2 +21,3 @@ 'use strict';

const {compute} = require('./compute');
const {remove} = require('./remove');
const {getExportDefault} = require('./get-export-default');

@@ -27,6 +28,3 @@ const {

} = require('./properties');
const {
assign,
entries,
} = Object;
const {assign} = Object;

@@ -117,49 +115,4 @@ module.exports.getBinding = getBinding;

const isOneDeclaration = ({node}) => node.declarations.length === 1;
module.exports.remove = remove;
const getComments = (path) => {
const {comments} = path.node;
if (comments?.length)
return comments;
const {parentPath} = path;
if (path.isVariableDeclarator() && isOneDeclaration(parentPath)) {
return parentPath.node.comments;
}
return [];
};
const getPrevSibling = (path) => {
if (!path.isVariableDeclarator())
return path.getPrevSibling();
return path.parentPath.getPrevSibling();
};
module.exports.remove = (path) => {
const programBlock = path.scope.getProgramParent().block;
const prev = getPrevSibling(path);
if (path.scope.block === programBlock && !prev.node)
programBlock.comments = getComments(path);
if (path.parentPath.isArrayPattern()) {
const elements = path.parentPath.get('elements');
for (const [index, el] of entries(elements)) {
if (el === path) {
path.parentPath.node.elements[index] = null;
break;
}
}
return;
}
path.remove();
};
module.exports.getPathAfterImports = (body) => {

@@ -166,0 +119,0 @@ const n = body.length;

{
"name": "@putout/operate",
"version": "8.9.0",
"version": "8.9.1",
"type": "commonjs",

@@ -5,0 +5,0 @@ "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",

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