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.8 to 1.4.9

2

bower.json
{
"name": "asty",
"version": "1.4.8",
"version": "1.4.9",
"description": "Abstract Syntax Tree (AST) Data Structure",

@@ -5,0 +5,0 @@ "main": "lib/asty.browser.js",

/*
** ASTy -- Abstract Syntax Tree (AST) Data Structure
** Copyright (c) 2014-2016 Ralf S. Engelschall <rse@engelschall.com>
** Copyright (c) 2014-2017 Ralf S. Engelschall <rse@engelschall.com>
**

@@ -5,0 +5,0 @@ ** Permission is hereby granted, free of charge, to any person obtaining

/*
** ASTy -- Abstract Syntax Tree (AST) Data Structure
** Copyright (c) 2014-2016 Ralf S. Engelschall <rse@engelschall.com>
** Copyright (c) 2014-2017 Ralf S. Engelschall <rse@engelschall.com>
**

@@ -26,15 +26,15 @@ ** Permission is hereby granted, free of charge, to any person obtaining

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

/*
** ASTy -- Abstract Syntax Tree (AST) Data Structure
** Copyright (c) 2014-2016 Ralf S. Engelschall <rse@engelschall.com>
** Copyright (c) 2014-2017 Ralf S. Engelschall <rse@engelschall.com>
**

@@ -40,3 +40,3 @@ ** Permission is hereby granted, free of charge, to any person obtaining

** ASTy -- Abstract Syntax Tree (AST) Data Structure
** Copyright (c) 2014-2016 Ralf S. Engelschall <rse@engelschall.com>
** Copyright (c) 2014-2017 Ralf S. Engelschall <rse@engelschall.com>
**

@@ -310,3 +310,3 @@ ** Permission is hereby granted, free of charge, to any person obtaining

** ASTy -- Abstract Syntax Tree (AST) Data Structure
** Copyright (c) 2014-2016 Ralf S. Engelschall <rse@engelschall.com>
** Copyright (c) 2014-2017 Ralf S. Engelschall <rse@engelschall.com>
**

@@ -352,41 +352,36 @@ ** Permission is hereby granted, free of charge, to any person obtaining

if (keys.length > 0) {
(function () {
out += "(";
var first = true;
keys.forEach(function (key) {
if (!first) out += ", ";else first = false;
out += key + ": ";
var value = node.A[key];
(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;
}
})();
});
out += ") ";
})();
out += "(";
var first = true;
keys.forEach(function (key) {
if (!first) out += ", ";else first = false;
out += key + ": ";
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;
}
});
out += ") ";
}

@@ -417,3 +412,3 @@ out += "[" + node.L.L + "/" + node.L.C + "]\n";

** ASTy -- Abstract Syntax Tree (AST) Data Structure
** Copyright (c) 2014-2016 Ralf S. Engelschall <rse@engelschall.com>
** Copyright (c) 2014-2017 Ralf S. Engelschall <rse@engelschall.com>
**

@@ -491,3 +486,3 @@ ** Permission is hereby granted, free of charge, to any person obtaining

** ASTy -- Abstract Syntax Tree (AST) Data Structure
** Copyright (c) 2014-2016 Ralf S. Engelschall <rse@engelschall.com>
** Copyright (c) 2014-2017 Ralf S. Engelschall <rse@engelschall.com>
**

@@ -604,3 +599,3 @@ ** Permission is hereby granted, free of charge, to any person obtaining

** ASTy -- Abstract Syntax Tree (AST) Data Structure
** Copyright (c) 2014-2016 Ralf S. Engelschall <rse@engelschall.com>
** Copyright (c) 2014-2017 Ralf S. Engelschall <rse@engelschall.com>
**

@@ -629,4 +624,4 @@ ** Permission is hereby granted, free of charge, to any person obtaining

/* global 4: false */
/* global 8: false */
/* global 20161120: false */
/* global 9: false */
/* global 20170410: false */

@@ -636,4 +631,4 @@ var version = {

minor: 4,
micro: 8,
date: 20161120
micro: 9,
date: 20170410
};

@@ -656,3 +651,3 @@

** ASTy -- Abstract Syntax Tree (AST) Data Structure
** Copyright (c) 2014-2016 Ralf S. Engelschall <rse@engelschall.com>
** Copyright (c) 2014-2017 Ralf S. Engelschall <rse@engelschall.com>
**

@@ -715,3 +710,3 @@ ** Permission is hereby granted, free of charge, to any person obtaining

** ASTy -- Abstract Syntax Tree (AST) Data Structure
** Copyright (c) 2014-2016 Ralf S. Engelschall <rse@engelschall.com>
** Copyright (c) 2014-2017 Ralf S. Engelschall <rse@engelschall.com>
**

@@ -718,0 +713,0 @@ ** Permission is hereby granted, free of charge, to any person obtaining

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

@@ -22,3 +22,3 @@ "keywords": [ "ast", "abstract", "syntax", "tree", "data", "structure" ],

"grunt-cli": "~1.2.0",
"grunt-contrib-jshint": "~1.0.0",
"grunt-contrib-jshint": "~1.1.0",
"grunt-contrib-clean": "~1.0.0",

@@ -29,8 +29,8 @@ "grunt-browserify": "~5.0.0",

"grunt-eslint": "~19.0.0",
"babel-eslint": "~7.1.1",
"mocha": "~3.1.2",
"babel-eslint": "~7.2.1",
"mocha": "~3.2.0",
"chai": "~3.5.0",
"babelify": "~7.3.0",
"babel-preset-es2015": "~6.18.0",
"minifyify": "~7.3.4",
"babel-preset-es2015": "~6.24.1",
"minifyify": "~7.3.5",
"browserify-header": "~0.9.2",

@@ -37,0 +37,0 @@ "browserify-derequire": "~0.9.4",

@@ -167,3 +167,3 @@

Copyright (c) 2014-2016 Ralf S. Engelschall (http://engelschall.com/)
Copyright (c) 2014-2017 Ralf S. Engelschall (http://engelschall.com/)

@@ -170,0 +170,0 @@ Permission is hereby granted, free of charge, to any person obtaining

/*
** ASTy -- Abstract Syntax Tree (AST) Data Structure
** Copyright (c) 2014-2016 Ralf S. Engelschall <rse@engelschall.com>
** Copyright (c) 2014-2017 Ralf S. Engelschall <rse@engelschall.com>
**

@@ -5,0 +5,0 @@ ** Permission is hereby granted, free of charge, to any person obtaining

/*
** ASTy -- Abstract Syntax Tree (AST) Data Structure
** Copyright (c) 2014-2016 Ralf S. Engelschall <rse@engelschall.com>
** Copyright (c) 2014-2017 Ralf S. Engelschall <rse@engelschall.com>
**

@@ -5,0 +5,0 @@ ** Permission is hereby granted, free of charge, to any person obtaining

/*
** ASTy -- Abstract Syntax Tree (AST) Data Structure
** Copyright (c) 2014-2016 Ralf S. Engelschall <rse@engelschall.com>
** Copyright (c) 2014-2017 Ralf S. Engelschall <rse@engelschall.com>
**

@@ -5,0 +5,0 @@ ** Permission is hereby granted, free of charge, to any person obtaining

/*
** ASTy -- Abstract Syntax Tree (AST) Data Structure
** Copyright (c) 2014-2016 Ralf S. Engelschall <rse@engelschall.com>
** Copyright (c) 2014-2017 Ralf S. Engelschall <rse@engelschall.com>
**

@@ -5,0 +5,0 @@ ** Permission is hereby granted, free of charge, to any person obtaining

/*
** ASTy -- Abstract Syntax Tree (AST) Data Structure
** Copyright (c) 2014-2016 Ralf S. Engelschall <rse@engelschall.com>
** Copyright (c) 2014-2017 Ralf S. Engelschall <rse@engelschall.com>
**

@@ -5,0 +5,0 @@ ** Permission is hereby granted, free of charge, to any person obtaining

/*
** ASTy -- Abstract Syntax Tree (AST) Data Structure
** Copyright (c) 2014-2016 Ralf S. Engelschall <rse@engelschall.com>
** Copyright (c) 2014-2017 Ralf S. Engelschall <rse@engelschall.com>
**

@@ -5,0 +5,0 @@ ** Permission is hereby granted, free of charge, to any person obtaining

/*
** ASTy -- Abstract Syntax Tree (AST) Data Structure
** Copyright (c) 2014-2016 Ralf S. Engelschall <rse@engelschall.com>
** Copyright (c) 2014-2017 Ralf S. Engelschall <rse@engelschall.com>
**

@@ -5,0 +5,0 @@ ** Permission is hereby granted, free of charge, to any person obtaining

/*
** ASTy -- Abstract Syntax Tree (AST) Data Structure
** Copyright (c) 2014-2016 Ralf S. Engelschall <rse@engelschall.com>
** Copyright (c) 2014-2017 Ralf S. Engelschall <rse@engelschall.com>
**

@@ -5,0 +5,0 @@ ** Permission is hereby granted, free of charge, to any person obtaining

Sorry, the diff of this file is not supported yet

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