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

ast-types

Package Overview
Dependencies
Maintainers
1
Versions
172
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ast-types - npm Package Compare versions

Comparing version 0.3.13 to 0.3.14

3

lib/node-path.js

@@ -224,2 +224,5 @@ var assert = require("assert");

if (n.YieldExpression.check(node))
return isBinary(parent);
return false;

@@ -226,0 +229,0 @@ };

40

lib/traverse.js
var assert = require("assert");
var types = require("./types");
var Node = types.namedTypes.Node;
var isObject = types.builtInTypes.object;
var isArray = types.builtInTypes.array;

@@ -23,19 +24,22 @@ var NodePath = require("./node-path");

assert.ok(path instanceof NodePath);
var value = path.value;
if (isArray.check(path.value)) {
if (isArray.check(value)) {
path.each(traverse);
return;
}
} else if (Node.check(path.value)) {
var node = path.value;
if (callback.call(path, node, traverse) === false) {
if (Node.check(value)) {
if (callback.call(path, value, traverse) === false) {
return;
}
} else if (!isObject.check(value)) {
return;
}
types.eachField(node, function(name, child) {
var childPath = path.get(name);
assert.strictEqual(childPath.value, child);
traverse(childPath);
});
}
types.eachField(value, function(name, child) {
var childPath = path.get(name);
assert.strictEqual(childPath.value, child);
traverse(childPath);
});
}

@@ -65,12 +69,16 @@

node.forEach(traverse);
return;
}
} else if (Node.check(node)) {
if (Node.check(node)) {
if (callback.call(context, node, traverse) === false) {
return;
}
} else if (!isObject.check(node)) {
return;
}
types.eachField(node, function(name, child) {
traverse(child);
});
}
types.eachField(node, function(name, child) {
traverse(child);
});
}

@@ -77,0 +85,0 @@

@@ -21,3 +21,3 @@ {

],
"version": "0.3.13",
"version": "0.3.14",
"homepage": "http://github.com/benjamn/ast-types",

@@ -24,0 +24,0 @@ "repository": {

@@ -436,2 +436,15 @@ var types = require("../main");

var binaryYield = b.expressionStatement(
b.logicalExpression(
"&&",
b.yieldExpression(b.identifier("a"), false),
b.yieldExpression(b.identifier("b"), true)
)
);
var byPath = new NodePath(binaryYield);
assert.ok(!byPath.get("expression").needsParens());
assert.ok(byPath.get("expression", "left").needsParens());
assert.ok(byPath.get("expression", "right").needsParens());
t.finish();

@@ -438,0 +451,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