Socket
Socket
Sign inDemoInstall

esutils

Package Overview
Dependencies
0
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.2 to 1.1.3

27

lib/ast.js

@@ -112,2 +112,28 @@ /*

function isProblematicIfStatement(node) {
var current;
if (node.type !== 'IfStatement') {
return false;
}
if (node.alternate == null) {
return false;
}
if (node.consequent.type === 'BlockStatement') {
return false;
}
current = node.consequent;
do {
if (current.type === 'IfStatement') {
if (!current.alternate) {
return true;
}
}
current = trailingStatement(current);
} while (current);
return false;
}
module.exports = {

@@ -118,2 +144,3 @@ isExpression: isExpression,

isSourceElement: isSourceElement,
isProblematicIfStatement: isProblematicIfStatement,

@@ -120,0 +147,0 @@ trailingStatement: trailingStatement

2

package.json

@@ -6,3 +6,3 @@ {

"main": "lib/utils.js",
"version": "1.1.2",
"version": "1.1.3",
"engines": {

@@ -9,0 +9,0 @@ "node": ">=0.10.0"

@@ -38,2 +38,21 @@ ### esutils [![Build Status](https://secure.travis-ci.org/Constellation/esutils.svg)](http://travis-ci.org/Constellation/esutils)

#### ast.isProblematicIfStatement(node)
Returns true if `node` is a problematic IfStatement. If `node` is a problematic `IfStatement`, `node` cannot be represented as an one on one JavaScript code.
```js
{
type: 'IfStatement',
consequent: {
type: 'WithStatement',
body: {
type: 'IfStatement',
consequent: {type: 'EmptyStatement'}
}
},
alternate: {type: 'EmptyStatement'}
}
```
The above node cannot be represented as a JavaScript code, since the top level `else` alternate belongs to an inner `IfStatement`.
### code

@@ -40,0 +59,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc