Comparing version 1.4.2 to 1.4.3
@@ -26,15 +26,15 @@ /* | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.ASTY = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ | ||
"use strict";function _classCallCheck(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},_createClass=function(){function e(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(n,t,r){return t&&e(n.prototype,t),r&&e(n,r),n}}();Object.defineProperty(exports,"__esModule",{value:!0});var ASTYBase=function(){function e(){_classCallCheck(this,e)}return _createClass(e,[{key:"init",value:function(e,n,t,r){if(arguments.length<2)throw new Error("init: invalid number of arguments");if(this.ctx=e,this.ASTy=!0,this.T=n,this.L={L:0,C:0,O:0},this.A={},this.C=[],this.P=null,"object"===("undefined"==typeof t?"undefined":_typeof(t)))for(var i in t)t.hasOwnProperty(i)&&this.set(i,t[i]);return"object"===("undefined"==typeof r?"undefined":_typeof(r))&&r instanceof Array&&this.add(r),this}},{key:"type",value:function(e){if(0===arguments.length)return this.T;if(1===arguments.length)return this.T=e,this;throw new Error("type: invalid number of arguments")}},{key:"pos",value:function(e,n,t){if(0===arguments.length)return{line:this.L.L,column:this.L.C,offset:this.L.O};if(arguments.length<=3)return this.L.L=e||0,this.L.C=n||0,this.L.O=t||0,this;throw new Error("pos: invalid number of arguments")}},{key:"set",value:function(){for(var e=this,n=arguments.length,t=Array(n),r=0;n>r;r++)t[r]=arguments[r];if(1===t.length&&"object"===_typeof(t[0]))Object.keys(t[0]).forEach(function(n){e.A[n]=t[0][n]});else{if(2!==t.length)throw new Error("set: invalid number of arguments");this.A[t[0]]=t[1]}return this}},{key:"unset",value:function(){var e=this;if(1===arguments.length&&"object"===_typeof(arguments.length<=0?void 0:arguments[0])&&(arguments.length<=0?void 0:arguments[0])instanceof Array)(arguments.length<=0?void 0:arguments[0]).forEach(function(n){delete e.A[n]});else{if(1!==arguments.length)throw new Error("unset: invalid number of arguments");delete this.A[arguments.length<=0?void 0:arguments[0]]}return this}},{key:"get",value:function(e){if(1!==arguments.length)throw new Error("get: invalid number of arguments");if("string"!=typeof e)throw new Error("get: invalid key argument");return this.A[e]}},{key:"attrs",value:function(){return Object.keys(this.A)}},{key:"nth",value:function(){if(null===this.P)return 1;var e=this.P.C.indexOf(this);if(0>e)throw new Error("nth: internal error -- node not in childs of its parent");return e}},{key:"ins",value:function(e){for(var n=this,t=arguments.length,r=Array(t>1?t-1:0),i=1;t>i;i++)r[i-1]=arguments[i];if(0===r.length)throw new Error("ins: invalid number of arguments");if(0>e&&(e=this.C.length+1-e),!(e>=0&&e<=this.C.length))throw new Error("ins: invalid position");var o=function(t){if(!n.ctx.isA(t))throw new Error("ins: invalid AST node argument");n.C.splice(e++,0,t),t.P=n};return r.forEach(function(e){"object"===("undefined"==typeof e?"undefined":_typeof(e))&&e instanceof Array?e.forEach(function(e){o(e)}):null!==e&&o(e)}),this}},{key:"add",value:function(){for(var e=this,n=arguments.length,t=Array(n),r=0;n>r;r++)t[r]=arguments[r];if(0===t.length)throw new Error("add: invalid number of arguments");var i=function(n){if(!e.ctx.isA(n))throw new Error("add: invalid AST node argument");e.C.push(n),n.P=e};return t.forEach(function(e){"object"===("undefined"==typeof e?"undefined":_typeof(e))&&e instanceof Array?e.forEach(function(e){i(e)}):null!==e&&i(e)}),this}},{key:"del",value:function(){for(var e=this,n=arguments.length,t=Array(n),r=0;n>r;r++)t[r]=arguments[r];if(0===t.length)throw new Error("del: invalid number of argument");return t.forEach(function(n){if(!e.ctx.isA(n))throw new Error("del: invalid AST node argument");for(var t=!1,r=0;r<e.C.length;r++)if(e.C[r]===n){e.C.splice(r,1),n.P=null,t=!0;break}if(!t)throw new Error("del: AST node not found in childs")}),this}},{key:"childs",value:function(){return this.C}},{key:"parent",value:function(){return this.P}},{key:"serialize",value:function(){return this.ctx.serialize(this.ctx,this)}}]),e}();exports["default"]=ASTYBase; | ||
"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 _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},_createClass=function(){function e(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(n,t,r){return t&&e(n.prototype,t),r&&e(n,r),n}}(),ASTYBase=function(){function e(){_classCallCheck(this,e)}return _createClass(e,[{key:"init",value:function(e,n,t,r){if(arguments.length<2)throw new Error("init: invalid number of arguments");if(this.ctx=e,this.ASTy=!0,this.T=n,this.L={L:0,C:0,O:0},this.A={},this.C=[],this.P=null,"object"===("undefined"==typeof t?"undefined":_typeof(t)))for(var i in t)t.hasOwnProperty(i)&&this.set(i,t[i]);return"object"===("undefined"==typeof r?"undefined":_typeof(r))&&r instanceof Array&&this.add(r),this}},{key:"type",value:function(e){if(0===arguments.length)return this.T;if(1===arguments.length)return this.T=e,this;throw new Error("type: invalid number of arguments")}},{key:"pos",value:function(e,n,t){if(0===arguments.length)return{line:this.L.L,column:this.L.C,offset:this.L.O};if(arguments.length<=3)return this.L.L=e||0,this.L.C=n||0,this.L.O=t||0,this;throw new Error("pos: invalid number of arguments")}},{key:"set",value:function(){for(var e=this,n=arguments.length,t=Array(n),r=0;n>r;r++)t[r]=arguments[r];if(1===t.length&&"object"===_typeof(t[0]))Object.keys(t[0]).forEach(function(n){e.A[n]=t[0][n]});else{if(2!==t.length)throw new Error("set: invalid number of arguments");this.A[t[0]]=t[1]}return this}},{key:"unset",value:function(){for(var e=this,n=arguments.length,t=Array(n),r=0;n>r;r++)t[r]=arguments[r];if(1===t.length&&"object"===_typeof(t[0])&&t[0]instanceof Array)t[0].forEach(function(n){delete e.A[n]});else{if(1!==t.length)throw new Error("unset: invalid number of arguments");delete this.A[t[0]]}return this}},{key:"get",value:function(e){if(1!==arguments.length)throw new Error("get: invalid number of arguments");if("string"!=typeof e)throw new Error("get: invalid key argument");return this.A[e]}},{key:"attrs",value:function(){return Object.keys(this.A)}},{key:"nth",value:function(){if(null===this.P)return 1;var e=this.P.C.indexOf(this);if(0>e)throw new Error("nth: internal error -- node not in childs of its parent");return e}},{key:"ins",value:function(e){for(var n=this,t=arguments.length,r=Array(t>1?t-1:0),i=1;t>i;i++)r[i-1]=arguments[i];if(0===r.length)throw new Error("ins: invalid number of arguments");if(0>e&&(e=this.C.length+1-e),!(e>=0&&e<=this.C.length))throw new Error("ins: invalid position");var o=function(t){if(!n.ctx.isA(t))throw new Error("ins: invalid AST node argument");n.C.splice(e++,0,t),t.P=n};return r.forEach(function(e){"object"===("undefined"==typeof e?"undefined":_typeof(e))&&e instanceof Array?e.forEach(function(e){o(e)}):null!==e&&o(e)}),this}},{key:"add",value:function(){for(var e=this,n=arguments.length,t=Array(n),r=0;n>r;r++)t[r]=arguments[r];if(0===t.length)throw new Error("add: invalid number of arguments");var i=function(n){if(!e.ctx.isA(n))throw new Error("add: invalid AST node argument");e.C.push(n),n.P=e};return t.forEach(function(e){"object"===("undefined"==typeof e?"undefined":_typeof(e))&&e instanceof Array?e.forEach(function(e){i(e)}):null!==e&&i(e)}),this}},{key:"del",value:function(){for(var e=this,n=arguments.length,t=Array(n),r=0;n>r;r++)t[r]=arguments[r];if(0===t.length)throw new Error("del: invalid number of argument");return t.forEach(function(n){if(!e.ctx.isA(n))throw new Error("del: invalid AST node argument");for(var t=!1,r=0;r<e.C.length;r++)if(e.C[r]===n){e.C.splice(r,1),n.P=null,t=!0;break}if(!t)throw new Error("del: AST node not found in childs")}),this}},{key:"childs",value:function(){return this.C}},{key:"parent",value:function(){return this.P}},{key:"serialize",value:function(){return this.ctx.serialize(this.ctx,this)}}]),e}();exports["default"]=ASTYBase; | ||
},{}],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")}var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},_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}}();Object.defineProperty(exports,"__esModule",{value:!0});var 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 o=0;t>o;o++)r+=" ";r+=n.T+" ";var a=Object.keys(n.A);a.length>0&&!function(){r+="(";var e=!0;a.forEach(function(t){e?e=!1:r+=", ",r+=t+": ";var o=n.A[t];switch("undefined"==typeof o?"undefined":_typeof(o)){case"boolean":case"number":r+=o.toString();break;case"string":var a=function(e){return e.charCodeAt(0).toString(16).toUpperCase()};r+='"'+o.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"+a(e)}).replace(/[\x10-\x1F\x80-\xFF]/g,function(e){return"\\x"+a(e)}).replace(/[\u0100-\u0FFF]/g,function(e){return"\\u0"+a(e)}).replace(/[\u1000-\uFFFF]/g,function(e){return"\\u"+a(e)})+'"';break;case"object":r+=o instanceof RegExp?o.source:JSON.stringify(o);break;default:r+=JSON.stringify(o)}}),r+=") "}(),r+="["+n.L.L+"/"+n.L.C+"]\n"}},"downward"),r}}]),e}();exports["default"]=ASTYDump; | ||
"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 _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},_createClass=function(){function e(e,n){for(var r=0;r<n.length;r++){var t=n[r];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(e,t.key,t)}}return function(n,r,t){return r&&e(n.prototype,r),t&&e(n,t),n}}(),ASTYDump=function(){function e(){_classCallCheck(this,e)}return _createClass(e,[{key:"dump",value:function(e){void 0===e&&(e=1/0);var n="";return this.walk(function(r,t){if(!(t>e)){for(var o=0;t>o;o++)n+=" ";n+=r.T+" ";var a=Object.keys(r.A);a.length>0&&!function(){n+="(";var e=!0;a.forEach(function(t){e?e=!1:n+=", ",n+=t+": ";var o=r.A[t];switch("undefined"==typeof o?"undefined":_typeof(o)){case"boolean":case"number":n+=o.toString();break;case"string":var a=function(e){return e.charCodeAt(0).toString(16).toUpperCase()};n+='"'+o.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"+a(e)}).replace(/[\x10-\x1F\x80-\xFF]/g,function(e){return"\\x"+a(e)}).replace(/[\u0100-\u0FFF]/g,function(e){return"\\u0"+a(e)}).replace(/[\u1000-\uFFFF]/g,function(e){return"\\u"+a(e)})+'"';break;case"object":n+=o instanceof RegExp?o.source:JSON.stringify(o);break;default:n+=JSON.stringify(o)}}),n+=") "}(),n+="["+r.L.L+"/"+r.L.C+"]\n"}},"downward"),n}}]),e}();exports["default"]=ASTYDump; | ||
},{}],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")}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}}();Object.defineProperty(exports,"__esModule",{value:!0});var 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]?!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="undefined"!=typeof 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 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){var t=this,n=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];if(!this.ctx.isA(e))throw new Error("merge: invalid AST node argument");if(n){var a=e.pos();this.pos(a.L,a.C,a.O)}return e.attrs().forEach(function(n){var a="undefined"!=typeof r[n]?r[n]:n;null!==a&&t.set(a,e.get(n))}),e.childs().forEach(function(e){t.add(e)}),this}}]),e}();exports["default"]=ASTYMerge; | ||
},{}],4:[function(_dereq_,module,exports){ | ||
"use strict";function _classCallCheck(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},_createClass=function(){function e(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(n,t,r){return t&&e(n.prototype,t),r&&e(n,r),n}}();Object.defineProperty(exports,"__esModule",{value:!0});var ASTYSerialize=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"serialize",value:function(e,n){var t=function r(e){var n={T:e.T,L:{L:e.L.L,C:e.L.C,O:e.L.O}},t=Object.keys(e.A);return t.length>0&&(n.A={},t.forEach(function(t){var r=e.A[t];switch("undefined"==typeof r?"undefined":_typeof(r)){case"boolean":case"number":case"string":n.A[t]=r;break;default:n.A[t]=JSON.parse(JSON.stringify(r))}})),e.C.length>0&&(n.C=e.C.map(function(e){return r(e)})),n};if(!e.isA(n))throw new Error("serialize: not an ASTy node");return JSON.stringify({ASTy:t(n)})}},{key:"unserialize",value:function(e,n){var t=function o(n){var t=e.create(n.T);return t.pos(n.L.L,n.L.C,n.L.O),"object"===_typeof(n.A)&&Object.keys(n.A).forEach(function(e){var r=n.A[e];switch("undefined"==typeof r?"undefined":_typeof(r)){case"boolean":case"number":case"string":t.set(e,r);break;default:t.set(e,JSON.parse(JSON.stringify(r)))}}),"object"===_typeof(n.C)&&n.C instanceof Array&&t.add(n.C.map(function(e){return o(e)})),t},r=JSON.parse(n);if("object"!==("undefined"==typeof r?"undefined":_typeof(r))||"object"!==_typeof(r.ASTy))throw new Error("unserialize: not an ASTy JSON export");return t(r.ASTy)}}]),e}();exports["default"]=ASTYSerialize; | ||
"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 _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},_createClass=function(){function e(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(n,t,r){return t&&e(n.prototype,t),r&&e(n,r),n}}(),ASTYSerialize=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"serialize",value:function(e,n){var t=function r(e){var n={T:e.T,L:{L:e.L.L,C:e.L.C,O:e.L.O}},t=Object.keys(e.A);return t.length>0&&(n.A={},t.forEach(function(t){var r=e.A[t];switch("undefined"==typeof r?"undefined":_typeof(r)){case"boolean":case"number":case"string":n.A[t]=r;break;default:n.A[t]=JSON.parse(JSON.stringify(r))}})),e.C.length>0&&(n.C=e.C.map(function(e){return r(e)})),n};if(!e.isA(n))throw new Error("serialize: not an ASTy node");return JSON.stringify({ASTy:t(n)})}},{key:"unserialize",value:function(e,n){var t=function o(n){var t=e.create(n.T);return t.pos(n.L.L,n.L.C,n.L.O),"object"===_typeof(n.A)&&Object.keys(n.A).forEach(function(e){var r=n.A[e];switch("undefined"==typeof r?"undefined":_typeof(r)){case"boolean":case"number":case"string":t.set(e,r);break;default:t.set(e,JSON.parse(JSON.stringify(r)))}}),"object"===_typeof(n.C)&&n.C instanceof Array&&t.add(n.C.map(function(e){return o(e)})),t},r=JSON.parse(n);if("object"!==("undefined"==typeof r?"undefined":_typeof(r))||"object"!==_typeof(r.ASTy))throw new Error("unserialize: not an ASTy JSON export");return t(r.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:2,date:20160207};exports["default"]=version; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var version={major:1,minor:4,micro:3,date:20160519};exports["default"]=version; | ||
},{}],6:[function(_dereq_,module,exports){ | ||
"use strict";function _classCallCheck(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,n){for(var a=0;a<n.length;a++){var r=n[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(n,a,r){return a&&e(n.prototype,a),r&&e(n,r),n}}();Object.defineProperty(exports,"__esModule",{value:!0});var ASTYWalk=function(){function e(){_classCallCheck(this,e)}return _createClass(e,[{key:"walk",value:function(e){var n=arguments.length<=1||void 0===arguments[1]?"downward":arguments[1],a=function r(a,t,l){("downward"===n||"both"===n)&&e.call(null,a,t,l,"downward"),a.C.forEach(function(e){r(e,t+1,a)}),("upward"===n||"both"===n)&&e.call(null,a,t,l,"upward")};return a(this,0,null),this}}]),e}();exports["default"]=ASTYWalk; | ||
"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]?"downward":arguments[1],a=function t(a,r,l){"downward"!==n&&"both"!==n||e.call(null,a,r,l,"downward"),a.C.forEach(function(e){t(e,r+1,a)}),"upward"!==n&&"both"!==n||e.call(null,a,r,l,"upward")};return a(this,0,null),this}}]),e}();exports["default"]=ASTYWalk; | ||
},{}],7:[function(_dereq_,module,exports){ | ||
"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},_createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),_astyBase=_dereq_("./asty-base.js"),_astyBase2=_interopRequireDefault(_astyBase),_astyMerge=_dereq_("./asty-merge.js"),_astyMerge2=_interopRequireDefault(_astyMerge),_astyWalk=_dereq_("./asty-walk.js"),_astyWalk2=_interopRequireDefault(_astyWalk),_astyDump=_dereq_("./asty-dump.js"),_astyDump2=_interopRequireDefault(_astyDump),_astySerialize=_dereq_("./asty-serialize.js"),_astySerialize2=_interopRequireDefault(_astySerialize),_astyVersion=_dereq_("./asty-version.js"),_astyVersion2=_interopRequireDefault(_astyVersion),ASTYCtx=function(){function e(){var t=this;_classCallCheck(this,e),this.ASTYNode=function(){};var r=[[_astyBase2["default"],"init","type","pos","set","unset","get","attrs","nth","ins","add","del","childs","parent"],[_astyMerge2["default"],"merge"],[_astyWalk2["default"],"walk"],[_astyDump2["default"],"dump"]];return r.forEach(function(e){var r=e[0].prototype;e.slice(1).forEach(function(e){t.ASTYNode.prototype[e]=r[e]})}),this}return _createClass(e,[{key:"version",value:function(){return _astyVersion2["default"]}},{key:"extend",value:function(e){for(var t in e)e.hasOwnProperty(t)&&(this.ASTYNode.prototype[t]=e[t]);return this}},{key:"create",value:function(e){return(new this.ASTYNode).init(this,e)}},{key:"isA",value:function(e){return"object"===("undefined"==typeof e?"undefined":_typeof(e))&&e instanceof this.ASTYNode&&"boolean"==typeof e.ASTy&&e.ASTy===!0}},{key:"serialize",value:function(e){return _astySerialize2["default"].serialize(this,e)}},{key:"unserialize",value:function(e){return _astySerialize2["default"].unserialize(this,e)}}]),e}();module.exports=ASTYCtx; | ||
"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},_createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),_astyBase=_dereq_("./asty-base.js"),_astyBase2=_interopRequireDefault(_astyBase),_astyMerge=_dereq_("./asty-merge.js"),_astyMerge2=_interopRequireDefault(_astyMerge),_astyWalk=_dereq_("./asty-walk.js"),_astyWalk2=_interopRequireDefault(_astyWalk),_astyDump=_dereq_("./asty-dump.js"),_astyDump2=_interopRequireDefault(_astyDump),_astySerialize=_dereq_("./asty-serialize.js"),_astySerialize2=_interopRequireDefault(_astySerialize),_astyVersion=_dereq_("./asty-version.js"),_astyVersion2=_interopRequireDefault(_astyVersion),ASTYCtx=function(){function e(){var t=this;_classCallCheck(this,e),this.ASTYNode=function(){};var r=[[_astyBase2["default"],"init","type","pos","set","unset","get","attrs","nth","ins","add","del","childs","parent","serialize"],[_astyMerge2["default"],"merge"],[_astyWalk2["default"],"walk"],[_astyDump2["default"],"dump"]];return r.forEach(function(e){var r=e[0].prototype;e.slice(1).forEach(function(e){t.ASTYNode.prototype[e]=r[e]})}),this}return _createClass(e,[{key:"version",value:function(){return _astyVersion2["default"]}},{key:"extend",value:function(e){for(var t in e)e.hasOwnProperty(t)&&(this.ASTYNode.prototype[t]=e[t]);return this}},{key:"create",value:function(e){return(new this.ASTYNode).init(this,e)}},{key:"isA",value:function(e){return"object"===("undefined"==typeof e?"undefined":_typeof(e))&&e instanceof this.ASTYNode&&"boolean"==typeof e.ASTy&&e.ASTy===!0}},{key:"serialize",value:function(e){return _astySerialize2["default"].serialize(this,e)}},{key:"unserialize",value:function(e){return _astySerialize2["default"].unserialize(this,e)}}]),e}();module.exports=ASTYCtx; | ||
},{"./asty-base.js":1,"./asty-dump.js":2,"./asty-merge.js":3,"./asty-serialize.js":4,"./asty-version.js":5,"./asty-walk.js":6}]},{},[1,2,3,4,5,6,7])(7) | ||
@@ -41,0 +41,0 @@ }); |
@@ -28,2 +28,6 @@ /* | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; | ||
@@ -33,6 +37,2 @@ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -145,7 +145,11 @@ | ||
if (arguments.length === 1 && _typeof(arguments.length <= 0 ? undefined : arguments[0]) === "object" && (arguments.length <= 0 ? undefined : arguments[0]) instanceof Array) { | ||
(arguments.length <= 0 ? undefined : arguments[0]).forEach(function (key) { | ||
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
args[_key2] = arguments[_key2]; | ||
} | ||
if (args.length === 1 && _typeof(args[0]) === "object" && args[0] instanceof Array) { | ||
args[0].forEach(function (key) { | ||
delete _this2.A[key]; | ||
}); | ||
} else if (arguments.length === 1) delete this.A[arguments.length <= 0 ? undefined : arguments[0]];else throw new Error("unset: invalid number of arguments"); | ||
} else if (args.length === 1) delete this.A[args[0]];else throw new Error("unset: invalid number of arguments"); | ||
return this; | ||
@@ -190,4 +194,4 @@ } | ||
for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { | ||
args[_key2 - 1] = arguments[_key2]; | ||
for (var _len3 = arguments.length, args = Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { | ||
args[_key3 - 1] = arguments[_key3]; | ||
} | ||
@@ -218,4 +222,4 @@ | ||
for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { | ||
args[_key3] = arguments[_key3]; | ||
for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { | ||
args[_key4] = arguments[_key4]; | ||
} | ||
@@ -244,4 +248,4 @@ | ||
for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { | ||
args[_key4] = arguments[_key4]; | ||
for (var _len5 = arguments.length, args = Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { | ||
args[_key5] = arguments[_key5]; | ||
} | ||
@@ -299,2 +303,6 @@ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; | ||
@@ -304,6 +312,2 @@ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -405,4 +409,2 @@ | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -412,2 +414,4 @@ value: true | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -478,2 +482,6 @@ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; | ||
@@ -483,6 +491,2 @@ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -628,4 +632,4 @@ | ||
/* global 4: false */ | ||
/* global 2: false */ | ||
/* global 20160207: false */ | ||
/* global 3: false */ | ||
/* global 20160519: false */ | ||
@@ -635,4 +639,4 @@ var version = { | ||
minor: 4, | ||
micro: 2, | ||
date: 20160207 | ||
micro: 3, | ||
date: 20160519 | ||
}; | ||
@@ -645,4 +649,2 @@ | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -652,2 +654,4 @@ value: true | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -772,3 +776,3 @@ | ||
this.ASTYNode = function () {}; | ||
var mixins = [[_astyBase2.default, "init", "type", "pos", "set", "unset", "get", "attrs", "nth", "ins", "add", "del", "childs", "parent"], [_astyMerge2.default, "merge"], [_astyWalk2.default, "walk"], [_astyDump2.default, "dump"]]; | ||
var mixins = [[_astyBase2.default, "init", "type", "pos", "set", "unset", "get", "attrs", "nth", "ins", "add", "del", "childs", "parent", "serialize"], [_astyMerge2.default, "merge"], [_astyWalk2.default, "walk"], [_astyDump2.default, "dump"]]; | ||
mixins.forEach(function (mixin) { | ||
@@ -823,2 +827,3 @@ var proto = mixin[0].prototype; | ||
module.exports = ASTYCtx; | ||
@@ -825,0 +830,0 @@ |
{ | ||
"name": "asty", | ||
"version": "1.4.2", | ||
"version": "1.4.3", | ||
"description": "Abstract Syntax Tree (AST) Data Structure", | ||
@@ -20,16 +20,16 @@ "keywords": [ "ast", "abstract", "syntax", "tree", "data", "structure" ], | ||
"devDependencies": { | ||
"grunt": "~0.4.5", | ||
"grunt-cli": "~0.1.13", | ||
"grunt-contrib-jshint": "~0.12.0", | ||
"grunt-contrib-clean": "~0.7.0", | ||
"grunt-browserify": "~4.0.1", | ||
"grunt-jscs": "~2.7.0", | ||
"grunt": "~1.0.1", | ||
"grunt-cli": "~1.2.0", | ||
"grunt-contrib-jshint": "~1.0.0", | ||
"grunt-contrib-clean": "~1.0.0", | ||
"grunt-browserify": "~5.0.0", | ||
"grunt-jscs": "~2.8.0", | ||
"grunt-mocha-test": "~0.12.7", | ||
"grunt-eslint": "~17.3.1", | ||
"babel-eslint": "~4.1.8", | ||
"grunt-eslint": "~18.1.0", | ||
"babel-eslint": "~6.0.4", | ||
"mocha": "~2.4.5", | ||
"chai": "~3.5.0", | ||
"babelify": "~7.2.0", | ||
"babel-preset-es2015": "~6.3.13", | ||
"minifyify": "~7.2.1", | ||
"babelify": "~7.3.0", | ||
"babel-preset-es2015": "~6.9.0", | ||
"minifyify": "~7.3.3", | ||
"browserify-header": "~0.9.2", | ||
@@ -36,0 +36,0 @@ "browserify-derequire": "~0.9.4", |
@@ -39,3 +39,3 @@ /* | ||
"nth", "ins", "add", "del", | ||
"childs", "parent" ], | ||
"childs", "parent", "serialize" ], | ||
[ ASTYMerge, "merge" ], | ||
@@ -42,0 +42,0 @@ [ ASTYWalk, "walk" ], |
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
1870
148520