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.2.6 to 0.2.7

3

def/core.js

@@ -202,3 +202,3 @@ var types = require("../lib/types");

.bases("Node") // Want to be able to visit Property Nodes.
.build("kind", "key", "val")
.build("kind", "key", "value")
.field("kind", or("init", "get", "set"))

@@ -251,2 +251,3 @@ .field("key", or(def("Literal"), def("Identifier")))

.field("operator", AssignmentOperator)
// TODO Shouldn't this be def("Pattern")?
.field("left", def("Expression"))

@@ -253,0 +254,0 @@ .field("right", def("Expression"));

@@ -50,8 +50,18 @@ var assert = require("assert");

var result = this.check(value, deep);
assert.ok(
result,
JSON.stringify(value) + " does not match type " + this);
assert.ok(result, shallowStringify(value) + " does not match type " + this);
return result;
};
function shallowStringify(value) {
if (isObject.check(value))
return "{" + Object.keys(value).map(function(key) {
return key + ": " + value[key];
}).join(", ") + "}";
if (isArray.check(value))
return "[" + value.map(shallowStringify).join(", ") + "]";
return JSON.stringify(value);
}
Tp.toString = function() {

@@ -432,3 +442,3 @@ var name = this.name;

type.check(value),
JSON.stringify(value) +
shallowStringify(value) +
" does not match field " + field +

@@ -435,0 +445,0 @@ " of type " + typeName);

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

],
"version": "0.2.6",
"version": "0.2.7",
"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