Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

asty

Package Overview
Dependencies
Maintainers
1
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asty - npm Package Compare versions

Comparing version 1.4.6 to 1.4.7

2

Gruntfile.js

@@ -46,3 +46,3 @@ /*

options: {
config: "eslint.json"
configFile: "eslint.json"
},

@@ -49,0 +49,0 @@ "asty": [ "src/**/*.js", "tst/**/*.js" ]

@@ -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")}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;
"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}}(),ASTYBase=function(){function e(){_classCallCheck(this,e)}return _createClass(e,[{key:"init",value:function(e,t,n,r){if(arguments.length<2)throw new Error("init: invalid number of arguments");if(this.ctx=e,this.ASTy=!0,this.T=t,this.L={L:0,C:0,O:0},this.A={},this.C=[],this.P=null,"object"===("undefined"==typeof n?"undefined":_typeof(n)))for(var i in n)n.hasOwnProperty(i)&&this.set(i,n[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,t,n){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=t||0,this.L.O=n||0,this;throw new Error("pos: invalid number of arguments")}},{key:"set",value:function(){for(var e=this,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];if(1===n.length&&"object"===_typeof(n[0]))Object.keys(n[0]).forEach(function(t){e.A[t]=n[0][t]});else{if(2!==n.length)throw new Error("set: invalid number of arguments");this.A[n[0]]=n[1]}return this}},{key:"unset",value:function(){for(var e=this,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];if(1===n.length&&"object"===_typeof(n[0])&&n[0]instanceof Array)n[0].forEach(function(t){delete e.A[t]});else{if(1!==n.length)throw new Error("unset: invalid number of arguments");delete this.A[n[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(e<0)throw new Error("nth: internal error -- node not in childs of its parent");return e}},{key:"ins",value:function(e){for(var t=this,n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];if(0===r.length)throw new Error("ins: invalid number of arguments");if(e<0&&(e=this.C.length+1-e),!(0<=e&&e<=this.C.length))throw new Error("ins: invalid position");var o=function(n){if(!t.ctx.isA(n))throw new Error("ins: invalid AST node argument");t.C.splice(e++,0,n),n.P=t};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,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];if(0===n.length)throw new Error("add: invalid number of arguments");var i=function(t){if(!e.ctx.isA(t))throw new Error("add: invalid AST node argument");e.C.push(t),t.P=e};return n.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,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];if(0===n.length)throw new Error("del: invalid number of argument");return n.forEach(function(t){if(!e.ctx.isA(t))throw new Error("del: invalid AST node argument");for(var n=!1,r=0;r<e.C.length;r++)if(e.C[r]===t){e.C.splice(r,1),t.P=null,n=!0;break}if(!n)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,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;
"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&&e!==Symbol.prototype?"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;o<t;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];!function(){switch("undefined"==typeof o?"undefined":_typeof(o)){case"boolean":case"number":n+=o.toString();break;case"string":var e=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(n){return"\\x0"+e(n)}).replace(/[\x10-\x1F\x80-\xFF]/g,function(n){return"\\x"+e(n)}).replace(/[\u0100-\u0FFF]/g,function(n){return"\\u0"+e(n)}).replace(/[\u1000-\uFFFF]/g,function(n){return"\\u"+e(n)})+'"';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")}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;
"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]&&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")}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;
"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&&e!==Symbol.prototype?"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 e(n){var t={T:n.T,L:{L:n.L.L,C:n.L.C,O:n.L.O}},r=Object.keys(n.A);return r.length>0&&(t.A={},r.forEach(function(e){var r=n.A[e];switch("undefined"==typeof r?"undefined":_typeof(r)){case"boolean":case"number":case"string":t.A[e]=r;break;default:t.A[e]=JSON.parse(JSON.stringify(r))}})),n.C.length>0&&(t.C=n.C.map(function(n){return e(n)})),t};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 n(t){var r=e.create(t.T);return r.pos(t.L.L,t.L.C,t.L.O),"object"===_typeof(t.A)&&Object.keys(t.A).forEach(function(e){var n=t.A[e];switch("undefined"==typeof n?"undefined":_typeof(n)){case"boolean":case"number":case"string":r.set(e,n);break;default:r.set(e,JSON.parse(JSON.stringify(n)))}}),"object"===_typeof(t.C)&&t.C instanceof Array&&r.add(t.C.map(function(e){return n(e)})),r},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:6,date:20160627};exports["default"]=version;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var version={major:1,minor:4,micro:7,date:20160930};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")}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;
"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",a=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 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","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;
"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&&e!==Symbol.prototype?"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 @@ });

@@ -32,3 +32,3 @@ /*

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; };
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

@@ -302,3 +302,3 @@ 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; }; }();

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; };
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

@@ -359,28 +359,31 @@ 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; }; }();

var value = node.A[key];
switch (typeof value === "undefined" ? "undefined" : _typeof(value)) {
case "boolean":
case "number":
out += value.toString();
break;
case "string":
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.source;else out += JSON.stringify(value);
break;
default:
out += JSON.stringify(value);
break;
}
(function () {
switch (typeof value === "undefined" ? "undefined" : _typeof(value)) {
case "boolean":
case "number":
out += value.toString();
break;
case "string":
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.source;else out += JSON.stringify(value);
break;
default:
out += JSON.stringify(value);
break;
}
})();
});

@@ -448,4 +451,4 @@ out += ") ";

var takePos = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
var attrMap = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
var takePos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var attrMap = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

@@ -480,3 +483,3 @@ if (!this.ctx.isA(node)) throw new Error("merge: invalid AST node argument");

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; };
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

@@ -625,4 +628,4 @@ 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; }; }();

/* global 4: false */
/* global 6: false */
/* global 20160627: false */
/* global 7: false */
/* global 20160930: false */

@@ -632,4 +635,4 @@ var version = {

minor: 4,
micro: 6,
date: 20160627
micro: 7,
date: 20160930
};

@@ -684,3 +687,3 @@

value: function walk(cb) {
var when = arguments.length <= 1 || arguments[1] === undefined ? "downward" : arguments[1];
var when = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "downward";

@@ -707,3 +710,3 @@ var _walk = function _walk(node, depth, parent) {

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; };
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

@@ -710,0 +713,0 @@ 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; }; }(); /*

{
"name": "asty",
"version": "1.4.6",
"version": "1.4.7",
"description": "Abstract Syntax Tree (AST) Data Structure",

@@ -26,9 +26,9 @@ "keywords": [ "ast", "abstract", "syntax", "tree", "data", "structure" ],

"grunt-jscs": "~3.0.1",
"grunt-mocha-test": "~0.12.7",
"grunt-eslint": "~18.1.0",
"babel-eslint": "~6.1.0",
"mocha": "~2.5.3",
"grunt-mocha-test": "~0.13.2",
"grunt-eslint": "~19.0.0",
"babel-eslint": "~7.0.0",
"mocha": "~3.1.0",
"chai": "~3.5.0",
"babelify": "~7.3.0",
"babel-preset-es2015": "~6.9.0",
"babel-preset-es2015": "~6.16.0",
"minifyify": "~7.3.3",

@@ -35,0 +35,0 @@ "browserify-header": "~0.9.2",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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