Comparing version 1.4.9 to 1.5.0
{ | ||
"name": "asty", | ||
"version": "1.4.9", | ||
"version": "1.5.0", | ||
"description": "Abstract Syntax Tree (AST) Data Structure", | ||
@@ -5,0 +5,0 @@ "main": "lib/asty.browser.js", |
@@ -30,7 +30,7 @@ /* | ||
},{}],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 r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),ASTYMerge=function(){function e(){_classCallCheck(this,e)}return _createClass(e,[{key:"merge",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!this.ctx.isA(e))throw new Error("merge: invalid AST node argument");if(r){var a=e.pos();this.pos(a.L,a.C,a.O)}return e.attrs().forEach(function(r){var a=void 0!==n[r]?n[r]:r;null!==a&&t.set(a,e.get(r))}),e.childs().forEach(function(e){t.add(e)}),this}}]),e}();exports.default=ASTYMerge; | ||
"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 r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),ASTYMerge=function(){function e(){_classCallCheck(this,e)}return _createClass(e,[{key:"merge",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null===e)return this;if(!this.ctx.isA(e))throw new Error("merge: invalid AST node argument");if(r){var a=e.pos();this.pos(a.L,a.C,a.O)}return e.attrs().forEach(function(r){var a=void 0!==n[r]?n[r]:r;null!==a&&t.set(a,e.get(r))}),e.childs().forEach(function(e){t.add(e)}),this}}]),e}();exports.default=ASTYMerge; | ||
},{}],4:[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 _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_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}}(),ASTYSerialize=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"serialize",value:function(e,t){if(!e.isA(t))throw new Error("serialize: not an ASTy node");return JSON.stringify({ASTy:function e(t){var n={T:t.T,L:{L:t.L.L,C:t.L.C,O:t.L.O}},r=Object.keys(t.A);return r.length>0&&(n.A={},r.forEach(function(e){var r=t.A[e];switch(void 0===r?"undefined":_typeof(r)){case"boolean":case"number":case"string":n.A[e]=r;break;default:n.A[e]=JSON.parse(JSON.stringify(r))}})),t.C.length>0&&(n.C=t.C.map(function(t){return e(t)})),n}(t)})}},{key:"unserialize",value:function(e,t){var n=JSON.parse(t);if("object"!==(void 0===n?"undefined":_typeof(n))||"object"!==_typeof(n.ASTy))throw new Error("unserialize: not an ASTy JSON export");return function t(n){var r=e.create(n.T);return r.pos(n.L.L,n.L.C,n.L.O),"object"===_typeof(n.A)&&Object.keys(n.A).forEach(function(e){var t=n.A[e];switch(void 0===t?"undefined":_typeof(t)){case"boolean":case"number":case"string":r.set(e,t);break;default:r.set(e,JSON.parse(JSON.stringify(t)))}}),"object"===_typeof(n.C)&&n.C instanceof Array&&r.add(n.C.map(function(e){return t(e)})),r}(n.ASTy)}}]),e}();exports.default=ASTYSerialize; | ||
},{}],5:[function(_dereq_,module,exports){ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var version={major:1,minor:4,micro:9,date:20170410};exports.default=version; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var version={major:1,minor:5,micro:0,date:20170417};exports.default=version; | ||
},{}],6:[function(_dereq_,module,exports){ | ||
@@ -37,0 +37,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 a=0;a<n.length;a++){var t=n[a];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(e,t.key,t)}}return function(n,a,t){return a&&e(n.prototype,a),t&&e(n,t),n}}(),ASTYWalk=function(){function e(){_classCallCheck(this,e)}return _createClass(e,[{key:"walk",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"downward";return 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")}(this,0,null),this}}]),e}();exports.default=ASTYWalk; |
@@ -446,2 +446,3 @@ /* | ||
if (node === null) return this; | ||
if (!this.ctx.isA(node)) throw new Error("merge: invalid AST node argument"); | ||
@@ -618,11 +619,11 @@ if (takePos) { | ||
/* global 1: false */ | ||
/* global 4: false */ | ||
/* global 9: false */ | ||
/* global 20170410: false */ | ||
/* global 5: false */ | ||
/* global 0: false */ | ||
/* global 20170417: false */ | ||
var version = { | ||
major: 1, | ||
minor: 4, | ||
micro: 9, | ||
date: 20170410 | ||
minor: 5, | ||
micro: 0, | ||
date: 20170417 | ||
}; | ||
@@ -629,0 +630,0 @@ |
{ | ||
"name": "asty", | ||
"version": "1.4.9", | ||
"version": "1.5.0", | ||
"description": "Abstract Syntax Tree (AST) Data Structure", | ||
@@ -5,0 +5,0 @@ "keywords": [ "ast", "abstract", "syntax", "tree", "data", "structure" ], |
@@ -28,2 +28,4 @@ /* | ||
merge (node, takePos = false, attrMap = {}) { | ||
if (node === null) | ||
return this | ||
if (!this.ctx.isA(node)) | ||
@@ -30,0 +32,0 @@ throw new Error("merge: invalid AST node argument") |
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
148321
1869