Comparing version 0.9.8 to 0.9.9
{ | ||
"name": "asty", | ||
"version": "0.9.8", | ||
"version": "0.9.9", | ||
"description": "Abstract Syntax Tree (AST) Data Structure", | ||
@@ -5,0 +5,0 @@ "main": "lib/asty.browser.js", |
@@ -28,3 +28,3 @@ /* | ||
},{}],2:[function(_dereq_,module,exports){ | ||
"use strict";var _prototypeProperties=function(e,r,t){r&&Object.defineProperties(e,r),t&&Object.defineProperties(e.prototype,t)},ASTYDump=function(){function e(){}return _prototypeProperties(e,null,{dump:{value:function(){var e="";return this.walk(function(r,t){for(var n=0;t>n;n++)e+=" ";e+=r.T+" ";var o=Object.keys(r.A);if(o.length>0){e+="(";var i=!0;o.forEach(function(t){i?i=!1:e+=", ",e+=t+": ";var n=r.A[t];switch(typeof n){case"string":e+='"'+n.replace(/\n/,"\\n").replace(/"/,'\\"')+'"';break;case"object":e+=n instanceof RegExp?"/"+n.toString().replace(/^\//,"").replace(/\/$/,"").replace(/\//g,"\\/")+"/":JSON.stringify(n);break;default:e+=JSON.stringify(n)}}),e+=") "}e+="["+r.L.L+"/"+r.L.C+"]\n"},"downward"),e},writable:!0,enumerable:!0,configurable:!0}}),e}();module.exports=ASTYDump; | ||
"use strict";var _prototypeProperties=function(e,r,t){r&&Object.defineProperties(e,r),t&&Object.defineProperties(e.prototype,t)},ASTYDump=function(){function e(){}return _prototypeProperties(e,null,{dump:{value:function(e){void 0===e&&(e=1/0);var r="";return this.walk(function(t,n){if(!(n>e)){for(var i=0;n>i;i++)r+=" ";r+=t.T+" ";var o=Object.keys(t.A);if(o.length>0){r+="(";var a=!0;o.forEach(function(e){a?a=!1:r+=", ",r+=e+": ";var n=t.A[e];switch(typeof n){case"string":r+='"'+n.replace(/\n/,"\\n").replace(/"/,'\\"')+'"';break;case"object":r+=n instanceof RegExp?"/"+n.toString().replace(/^\//,"").replace(/\/$/,"").replace(/\//g,"\\/")+"/":JSON.stringify(n);break;default:r+=JSON.stringify(n)}}),r+=") "}r+="["+t.L.L+"/"+t.L.C+"]\n"}},"downward"),r},writable:!0,enumerable:!0,configurable:!0}}),e}();module.exports=ASTYDump; | ||
},{}],3:[function(_dereq_,module,exports){ | ||
@@ -31,0 +31,0 @@ "use strict";module.exports=function(){for(var t=function(){},r=0;r<arguments.length;r++){var o=arguments[r];"function"==typeof o&&(o=o.prototype);for(var e in o)Object.prototype.hasOwnProperty.call(o,e)&&(t.prototype[e]=o[e])}return t}; |
@@ -301,5 +301,7 @@ /* | ||
/* dump the AST recursively */ | ||
value: function dump() { | ||
value: function dump(maxDepth) { | ||
if (maxDepth === undefined) maxDepth = Infinity; | ||
var out = ""; | ||
this.walk(function (node, depth /*, parent, when */) { | ||
if (depth > maxDepth) return; | ||
for (var i = 0; i < depth; i++) out += " "; | ||
@@ -306,0 +308,0 @@ out += node.T + " "; |
{ | ||
"name": "asty", | ||
"version": "0.9.8", | ||
"version": "0.9.9", | ||
"description": "Abstract Syntax Tree (AST) Data Structure", | ||
@@ -5,0 +5,0 @@ "keywords": [ "ast", "abstract", "syntax", "tree", "data", "structure" ], |
@@ -106,4 +106,8 @@ | ||
- `ASTY#dump(): String`:<br/> | ||
Returns a textual dump of the AST starting at the current node. | ||
- `ASTY#dump(maxDepth?: Number): String`:<br/> | ||
Returns a textual dump of the AST starting at the current node. By | ||
default `maxDepth` is `Infinity` and this way the whole AST below the | ||
current node is dumped. If `maxDepth` is `0` only the current node is | ||
dumped. If `maxDepth` is `1` the current node and all its direct child | ||
nodes are dumped. | ||
@@ -110,0 +114,0 @@ License |
@@ -27,5 +27,9 @@ /* | ||
/* dump the AST recursively */ | ||
dump () { | ||
dump (maxDepth) { | ||
if (maxDepth === undefined) | ||
maxDepth = Infinity | ||
var out = "" | ||
this.walk(function (node, depth /*, parent, when */) { | ||
if (depth > maxDepth) | ||
return | ||
for (var i = 0; i < depth; i++) | ||
@@ -32,0 +36,0 @@ out += " " |
Sorry, the diff of this file is not supported yet
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
73644
1039
137