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.0 to 1.4.1

2

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

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

@@ -26,5 +26,5 @@ /*

(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 _typeof(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}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 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(){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 _typeof(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}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 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[0])&&arguments[0]instanceof Array)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[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 _typeof(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _classCallCheck(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,r){for(var n=0;n<r.length;n++){var t=r[n];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(e,t.key,t)}}return function(r,n,t){return n&&e(r.prototype,n),t&&e(r,t),r}}();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 a=0;t>a;a++)r+=" ";r+=n.T+" ";var c=Object.keys(n.A);c.length>0&&!function(){r+="(";var e=!0;c.forEach(function(t){e?e=!1:r+=", ",r+=t+": ";var a=n.A[t];switch("undefined"==typeof a?"undefined":_typeof(a)){case"string":var c=function(e){return e.charCodeAt(0).toString(16).toUpperCase()};r+='"'+a.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E\x0F]/g,function(e){return"\\x0"+c(e)}).replace(/[\x10-\x1F\x80-\xFF]/g,function(e){return"\\x"+c(e)}).replace(/[\u0100-\u0FFF]/g,function(e){return"\\u0"+c(e)}).replace(/[\u1000-\uFFFF]/g,function(e){return"\\u"+c(e)})+'"';break;case"object":r+=a instanceof RegExp?a.source:JSON.stringify(a);break;default:r+=JSON.stringify(a)}}),r+=") "}(),r+="["+n.L.L+"/"+n.L.C+"]\n"}},"downward"),r}}]),e}();exports["default"]=ASTYDump;
"use strict";function _typeof(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _classCallCheck(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,r){for(var n=0;n<r.length;n++){var t=r[n];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(e,t.key,t)}}return function(r,n,t){return n&&e(r.prototype,n),t&&e(r,t),r}}();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 a=0;t>a;a++)r+=" ";r+=n.T+" ";var c=Object.keys(n.A);c.length>0&&!function(){r+="(";var e=!0;c.forEach(function(t){e?e=!1:r+=", ",r+=t+": ";var a=n.A[t];switch("undefined"==typeof a?"undefined":_typeof(a)){case"boolean":case"number":r+=a.toString();break;case"string":var c=function(e){return e.charCodeAt(0).toString(16).toUpperCase()};r+='"'+a.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E\x0F]/g,function(e){return"\\x0"+c(e)}).replace(/[\x10-\x1F\x80-\xFF]/g,function(e){return"\\x"+c(e)}).replace(/[\u0100-\u0FFF]/g,function(e){return"\\u0"+c(e)}).replace(/[\u1000-\uFFFF]/g,function(e){return"\\u"+c(e)})+'"';break;case"object":r+=a instanceof RegExp?a.source:JSON.stringify(a);break;default:r+=JSON.stringify(a)}}),r+=") "}(),r+="["+n.L.L+"/"+n.L.C+"]\n"}},"downward"),r}}]),e}();exports["default"]=ASTYDump;
},{}],3:[function(_dereq_,module,exports){

@@ -35,3 +35,3 @@ "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;

},{}],5:[function(_dereq_,module,exports){
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var version={major:1,minor:4,micro:0,date:20151212};exports["default"]=version;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var version={major:1,minor:4,micro:1,date:20151229};exports["default"]=version;
},{}],6:[function(_dereq_,module,exports){

@@ -38,0 +38,0 @@ "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;

@@ -143,11 +143,7 @@ /*

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) {
if (arguments.length === 1 && _typeof(arguments[0]) === "object" && arguments[0] instanceof Array) {
arguments[0].forEach(function (key) {
delete _this2.A[key];
});
} else if (args.length === 1) delete this.A[args[0]];else throw new Error("unset: invalid number of arguments");
} else if (arguments.length === 1) delete this.A[arguments[0]];else throw new Error("unset: invalid number of arguments");
return this;

@@ -192,4 +188,4 @@ }

for (var _len3 = arguments.length, args = Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
args[_key3 - 1] = arguments[_key3];
for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
args[_key2 - 1] = arguments[_key2];
}

@@ -220,4 +216,4 @@

for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
args[_key4] = arguments[_key4];
for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}

@@ -246,4 +242,4 @@

for (var _len5 = arguments.length, args = Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
args[_key5] = arguments[_key5];
for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
args[_key4] = arguments[_key4];
}

@@ -362,2 +358,6 @@

switch (typeof value === "undefined" ? "undefined" : _typeof(value)) {
case "boolean":
case "number":
out += value.toString();
break;
case "string":

@@ -621,4 +621,4 @@ var hex = function hex(ch) {

/* global 4: false */
/* global 0: false */
/* global 20151212: false */
/* global 1: false */
/* global 20151229: false */

@@ -628,4 +628,4 @@ var version = {

minor: 4,
micro: 0,
date: 20151212
micro: 1,
date: 20151229
};

@@ -632,0 +632,0 @@

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

@@ -5,0 +5,0 @@ "keywords": [ "ast", "abstract", "syntax", "tree", "data", "structure" ],

@@ -49,2 +49,6 @@ /*

switch (typeof value) {
case "boolean":
case "number":
out += value.toString()
break
case "string":

@@ -51,0 +55,0 @@ let hex = (ch) => ch.charCodeAt(0).toString(16).toUpperCase()

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