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

@putout/compare

Package Overview
Dependencies
Maintainers
1
Versions
134
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@putout/compare - npm Package Compare versions

Comparing version 4.2.0 to 4.3.0

7

lib/compare.js

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

isEqualBody,
isEqualNop,
isLinkedNode,

@@ -81,2 +82,5 @@ isTemplate,

if (isEqualNop(node, baseNode))
return true;
if (isPath(path) && !isEqualType(node, baseNode)) {

@@ -179,2 +183,5 @@ const {type} = baseNode;

if (isEqualNop(nodeValue, value))
return true;
if (isLinkedNode(value)) {

@@ -181,0 +188,0 @@ const {name} = value;

@@ -5,4 +5,6 @@ 'use strict';

const {
isBlockStatement,
isIdentifier,
isLiteral,
isFunction,
isImportDefaultSpecifier,

@@ -19,2 +21,3 @@ } = require('@babel/types');

const BODY = '__body';
const NOP = '__nop';
const ANY = '__';

@@ -61,2 +64,6 @@

const isNop = (a) => isIdentifier(a, {
name: NOP,
});
const isAnyObject = (a) => isIdentifier(a, {

@@ -145,2 +152,17 @@ name: ANY_OBJECT,

module.exports.isEqualNop = (node, baseNode) => {
if (!isNop(baseNode))
return false;
if (!isFunction(node))
return false;
const {body} = node;
if (!isBlockStatement(body))
return false;
return !body.body.length;
};
module.exports.isLinkedNode = (a) => {

@@ -147,0 +169,0 @@ if (isIdentifier(a) && LINKED_NODE.test(a.name))

2

package.json
{
"name": "@putout/compare",
"version": "4.2.0",
"version": "4.3.0",
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",

@@ -5,0 +5,0 @@ "description": "compare ast-nodes",

@@ -134,2 +134,15 @@ # putout-compare [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL]

##### "__nop"
Any `Function` with no `arguments` and empty body;
```js
compare('const a = () => {}, 'const __a = __nop);
// returns
true
compare('const a = async () => {}, 'const a = () => __nop');
// returns
true
```
## License

@@ -136,0 +149,0 @@

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