Comparing version 1.1.4 to 1.1.5
{ | ||
"name": "asty", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"description": "Abstract Syntax Tree (AST) Data Structure", | ||
@@ -5,0 +5,0 @@ "main": "lib/asty.browser.js", |
@@ -28,7 +28,7 @@ /* | ||
},{}],2:[function(_dereq_,module,exports){ | ||
"use strict";function _classCallCheck(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),ASTYDump=function(){function e(){_classCallCheck(this,e)}return _createClass(e,[{key:"dump",value:function(e){void 0===e&&(e=1/0);var r="";return this.walk(function(t,n){if(!(n>e)){for(var a=0;n>a;a++)r+=" ";r+=t.T+" ";var c=Object.keys(t.A);c.length>0&&!function(){r+="(";var e=!0;c.forEach(function(n){e?e=!1:r+=", ",r+=n+": ";var a=t.A[n];switch(typeof a){case"string":r+='"'+a.replace(/\n/,"\\n").replace(/"/,'\\"')+'"';break;case"object":r+=a instanceof RegExp?"/"+a.toString().replace(/^\//,"").replace(/\/$/,"").replace(/\//g,"\\/")+"/":JSON.stringify(a);break;default:r+=JSON.stringify(a)}}),r+=") "}(),r+="["+t.L.L+"/"+t.L.C+"]\n"}},"downward"),r}}]),e}();exports["default"]=ASTYDump,module.exports=exports["default"]; | ||
"use strict";function _classCallCheck(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,r){for(var n=0;n<r.length;n++){var t=r[n];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(e,t.key,t)}}return function(r,n,t){return n&&e(r.prototype,n),t&&e(r,t),r}}(),ASTYDump=function(){function e(){_classCallCheck(this,e)}return _createClass(e,[{key:"dump",value:function(e){void 0===e&&(e=1/0);var r="";return this.walk(function(n,t){if(!(t>e)){for(var a=0;t>a;a++)r+=" ";r+=n.T+" ";var c=Object.keys(n.A);c.length>0&&!function(){r+="(";var e=!0;c.forEach(function(t){e?e=!1:r+=", ",r+=t+": ";var a=n.A[t];switch(typeof a){case"string":var c=function(e){return e.charCodeAt(0).toString(16).toUpperCase()};r+='"'+a.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E\x0F]/g,function(e){return"\\x0"+c(e)}).replace(/[\x10-\x1F\x80-\xFF]/g,function(e){return"\\x"+c(e)}).replace(/[\u0100-\u0FFF]/g,function(e){return"\\u0"+c(e)}).replace(/[\u1000-\uFFFF]/g,function(e){return"\\u"+c(e)})+'"';break;case"object":r+=a instanceof RegExp?a.source:JSON.stringify(a);break;default:r+=JSON.stringify(a)}}),r+=") "}(),r+="["+n.L.L+"/"+n.L.C+"]\n"}},"downward"),r}}]),e}();exports["default"]=ASTYDump,module.exports=exports["default"]; | ||
},{}],3:[function(_dereq_,module,exports){ | ||
"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),ASTYMerge=function(){function e(){_classCallCheck(this,e)}return _createClass(e,[{key:"merge",value:function(e,t,n){var r=this;if("object"!=typeof e)throw new Error("merge: invalid AST node argument");if("undefined"==typeof t&&(t=!1),"undefined"==typeof n&&(n={}),t){var o=e.pos();this.pos(o.L,o.C,o.O)}return e.attrs().forEach(function(t){var o="undefined"!=typeof n[t]?n[t]:t;null!==o&&r.set(o,e.get(t))}),e.childs().forEach(function(e){r.add(e)}),this}}]),e}();exports["default"]=ASTYMerge,module.exports=exports["default"]; | ||
},{}],4:[function(_dereq_,module,exports){ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var version={major:1,minor:1,micro:4,date:20150523};exports["default"]=version,module.exports=exports["default"]; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var version={major:1,minor:1,micro:5,date:20150530};exports["default"]=version,module.exports=exports["default"]; | ||
},{}],5:[function(_dereq_,module,exports){ | ||
@@ -35,0 +35,0 @@ "use strict";function _classCallCheck(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,n){for(var t=0;t<n.length;t++){var a=n[t];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(n,t,a){return t&&e(n.prototype,t),a&&e(n,a),n}}(),ASTYWalk=function(){function e(){_classCallCheck(this,e)}return _createClass(e,[{key:"walk",value:function(e,n){"undefined"==typeof n&&(n="downward");var t=function a(t,r,l){("downward"===n||"both"===n)&&e.call(null,t,r,l,"downward"),t.C.forEach(function(e){a(e,r+1,t)}),("upward"===n||"both"===n)&&e.call(null,t,r,l,"upward")};return t(this,0,null),this}}]),e}();exports["default"]=ASTYWalk,module.exports=exports["default"]; |
@@ -270,6 +270,17 @@ /* | ||
case "string": | ||
out += "\"" + value.replace(/\n/, "\\n").replace(/"/, "\\\"") + "\""; | ||
var hex = function hex(ch) { | ||
return ch.charCodeAt(0).toString(16).toUpperCase(); | ||
}; | ||
out += "\"" + value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\x08/g, "\\b").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\f/g, "\\f").replace(/\r/g, "\\r").replace(/[\x00-\x07\x0B\x0E\x0F]/g, function (ch) { | ||
return "\\x0" + hex(ch); | ||
}).replace(/[\x10-\x1F\x80-\xFF]/g, function (ch) { | ||
return "\\x" + hex(ch); | ||
}).replace(/[\u0100-\u0FFF]/g, function (ch) { | ||
return "\\u0" + hex(ch); | ||
}).replace(/[\u1000-\uFFFF]/g, function (ch) { | ||
return "\\u" + hex(ch); | ||
}) + "\""; | ||
break; | ||
case "object": | ||
if (value instanceof RegExp) out += "/" + value.toString().replace(/^\//, "").replace(/\/$/, "").replace(/\//g, "\\/") + "/";else out += JSON.stringify(value); | ||
if (value instanceof RegExp) out += value.source;else out += JSON.stringify(value); | ||
break; | ||
@@ -394,4 +405,4 @@ default: | ||
/* global 1: false */ | ||
/* global 4: false */ | ||
/* global 20150523: false */ | ||
/* global 5: false */ | ||
/* global 20150530: false */ | ||
@@ -406,4 +417,4 @@ "use strict"; | ||
minor: 1, | ||
micro: 4, | ||
date: 20150523 | ||
micro: 5, | ||
date: 20150530 | ||
}; | ||
@@ -410,0 +421,0 @@ |
{ | ||
"name": "asty", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"description": "Abstract Syntax Tree (AST) Data Structure", | ||
@@ -31,6 +31,6 @@ "keywords": [ "ast", "abstract", "syntax", "tree", "data", "structure" ], | ||
"grunt-eslint": "~13.0.0", | ||
"babel-eslint": "~3.1.8", | ||
"babel-eslint": "~3.1.9", | ||
"mocha": "~2.2.5", | ||
"chai": "~2.3.0", | ||
"babelify": "~6.1.1", | ||
"babelify": "~6.1.2", | ||
"minifyify": "~7.0.0", | ||
@@ -37,0 +37,0 @@ "browserify-header": "~0.9.2", |
@@ -50,12 +50,20 @@ /* | ||
case "string": | ||
out += "\"" + value.replace(/\n/, "\\n").replace(/"/, "\\\"") + "\"" | ||
let hex = (ch) => ch.charCodeAt(0).toString(16).toUpperCase() | ||
out += "\"" + | ||
value.replace(/\\/g, "\\\\") | ||
.replace(/"/g, "\\\"") | ||
.replace(/\x08/g, "\\b") | ||
.replace(/\t/g, "\\t") | ||
.replace(/\n/g, "\\n") | ||
.replace(/\f/g, "\\f") | ||
.replace(/\r/g, "\\r") | ||
.replace(/[\x00-\x07\x0B\x0E\x0F]/g, (ch) => "\\x0" + hex(ch)) | ||
.replace(/[\x10-\x1F\x80-\xFF]/g, (ch) => "\\x" + hex(ch)) | ||
.replace(/[\u0100-\u0FFF]/g, (ch) => "\\u0" + hex(ch)) | ||
.replace(/[\u1000-\uFFFF]/g, (ch) => "\\u" + hex(ch)) + | ||
"\"" | ||
break | ||
case "object": | ||
if (value instanceof RegExp) | ||
out += "/" + | ||
value.toString() | ||
.replace(/^\//, "") | ||
.replace(/\/$/, "") | ||
.replace(/\//g, "\\/") + | ||
"/" | ||
out += value.source | ||
else | ||
@@ -62,0 +70,0 @@ out += JSON.stringify(value) |
Sorry, the diff of this file is not supported yet
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
113302
1488