ast-types
Advanced tools
Comparing version 0.3.37 to 0.3.38
@@ -19,3 +19,3 @@ var types = require("../lib/types"); | ||
null | ||
), defaults["null"]); | ||
), defaults["null"], true); | ||
@@ -22,0 +22,0 @@ def("SourceLocation") |
@@ -281,10 +281,14 @@ var assert = require("assert"); | ||
Def.fromValue = function(value) { | ||
if (isObject.check(value) && | ||
hasOwn.call(value, "type") && | ||
hasOwn.call(defCache, value.type)) | ||
{ | ||
var vDef = defCache[value.type]; | ||
assert.strictEqual(vDef.finalized, true); | ||
return vDef; | ||
if (value && typeof value === "object") { | ||
var type = value.type; | ||
if (typeof type === "string" && | ||
hasOwn.call(defCache, type)) { | ||
var d = defCache[type]; | ||
if (d.finalized) { | ||
return d; | ||
} | ||
} | ||
} | ||
return null; | ||
}; | ||
@@ -291,0 +295,0 @@ |
@@ -21,3 +21,3 @@ { | ||
], | ||
"version": "0.3.37", | ||
"version": "0.3.38", | ||
"homepage": "http://github.com/benjamn/ast-types", | ||
@@ -24,0 +24,0 @@ "repository": { |
@@ -277,5 +277,3 @@ var assert = require("assert"); | ||
it("should give correct keys for supertypes", function() { | ||
check({ type: "Expression" }, [ | ||
"type", "loc" | ||
]); | ||
check({ type: "Expression" }, ["type"]); | ||
}); | ||
@@ -296,3 +294,3 @@ | ||
// Note that the "handlers" field is now hidden from eachField. | ||
"type", "block", "handler", "guardedHandlers", "finalizer", "loc" | ||
"type", "block", "handler", "guardedHandlers", "finalizer" | ||
]); | ||
@@ -302,3 +300,3 @@ }); | ||
check({ type: "CatchClause" }, [ | ||
"type", "param", "guard", "body", "loc" | ||
"type", "param", "guard", "body" | ||
]); | ||
@@ -305,0 +303,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
438157
12193