Socket
Socket
Sign inDemoInstall

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.8 to 0.3.9

32

lib/types.js

@@ -33,3 +33,3 @@ var assert = require("assert");

var result = check.call(self, value, deep);
if (!result && objToStr.call(deep) === funObjStr)
if (!result && deep && objToStr.call(deep) === funObjStr)
deep(self, value);

@@ -294,6 +294,9 @@ return result;

Dp.isSupertypeOf = function(that) {
assert.ok(that instanceof Def, that + " is not a Def");
assert.strictEqual(this.finalized, true);
assert.strictEqual(that.finalized, true);
return that.allSupertypes.hasOwnProperty(this.typeName);
if (that instanceof Def) {
assert.strictEqual(this.finalized, true);
assert.strictEqual(that.finalized, true);
return that.allSupertypes.hasOwnProperty(this.typeName);
} else {
assert.ok(false, that + " is not a Def");
}
};

@@ -326,8 +329,17 @@

var vDef = Def.fromValue(value);
if (!vDef) {
// If we couldn't infer the Def associated with the given value,
// and we expected it to be a SourceLocation or a Position, it was
// probably just missing a "type" field (because Esprima does not
// assign a type property to such nodes). Be optimistic and let
// this.checkAllFields make the final decision.
if (this.typeName === "SourceLocation" ||
this.typeName === "Position") {
return this.checkAllFields(value, deep);
}
// If we couldn't determine the Def associated with the given value,
// it was probably just missing a "type" field, so be optimistic and
// let this.checkAllFields make the final decision.
if (!vDef)
return this.checkAllFields(value, deep);
// Calling this.checkAllFields for any other type of node is both
// bad for performance and way too forgiving.
return false;
}

@@ -334,0 +346,0 @@ // If checking deeply and vDef === this, then we only need to call

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

],
"version": "0.3.8",
"version": "0.3.9",
"homepage": "http://github.com/benjamn/ast-types",

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

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