Comparing version 1.3.4 to 1.3.5
{ | ||
"name": "asty", | ||
"version": "1.3.4", | ||
"version": "1.3.5", | ||
"description": "Abstract Syntax Tree (AST) Data Structure", | ||
@@ -5,0 +5,0 @@ "main": "lib/asty.browser.js", |
@@ -26,3 +26,3 @@ /* | ||
(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(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _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"==typeof n)for(var i in n)n.hasOwnProperty(i)&&this.set(i,n[i]);return"object"==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;e>r;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;e>r;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 e(){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(t){for(var e=this,n=arguments.length,r=Array(n>1?n-1:0),i=1;n>i;i++)r[i-1]=arguments[i];if(0===r.length)throw new Error("ins: invalid number of arguments");if(0>t&&(t=this.C.length+1-t),!(t>=0&&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: "+JSON.stringify(n));e.C.splice(t++,0,n),n.P=e};return r.forEach(function(t){"object"==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;e>r;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: "+JSON.stringify(e));t.C.push(e),e.P=t};return n.forEach(function(t){"object"==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;e>r;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: "+JSON.stringify(e));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,module.exports=exports["default"]; | ||
"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 _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"==typeof n)for(var i in n)n.hasOwnProperty(i)&&this.set(i,n[i]);return"object"==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;e>r;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;e>r;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 e(){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(t){for(var e=this,n=arguments.length,r=Array(n>1?n-1:0),i=1;n>i;i++)r[i-1]=arguments[i];if(0===r.length)throw new Error("ins: invalid number of arguments");if(0>t&&(t=this.C.length+1-t),!(t>=0&&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"==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;e>r;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"==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;e>r;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,module.exports=exports["default"]; | ||
},{}],2:[function(_dereq_,module,exports){ | ||
@@ -35,3 +35,3 @@ "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 _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}}(),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(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,module.exports=exports["default"]; | ||
},{}],5:[function(_dereq_,module,exports){ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var version={major:1,minor:3,micro:4,date:20150821};exports["default"]=version,module.exports=exports["default"]; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var version={major:1,minor:3,micro:5,date:20150919};exports["default"]=version,module.exports=exports["default"]; | ||
},{}],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")}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,n){for(var t=0;t<n.length;t++){var a=n[t];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(n,t,a){return t&&e(n.prototype,t),a&&e(n,a),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],t=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 t(this,0,null),this}}]),e}();exports["default"]=ASTYWalk,module.exports=exports["default"]; |
@@ -189,3 +189,3 @@ /* | ||
var _ins = function _ins(node) { | ||
if (!_this3.ctx.isA(node)) throw new Error("ins: invalid AST node argument: " + JSON.stringify(node)); | ||
if (!_this3.ctx.isA(node)) throw new Error("ins: invalid AST node argument"); | ||
_this3.C.splice(pos++, 0, node); | ||
@@ -214,3 +214,3 @@ node.P = _this3; | ||
var _add = function _add(node) { | ||
if (!_this4.ctx.isA(node)) throw new Error("add: invalid AST node argument: " + JSON.stringify(node)); | ||
if (!_this4.ctx.isA(node)) throw new Error("add: invalid AST node argument"); | ||
_this4.C.push(node); | ||
@@ -239,3 +239,3 @@ node.P = _this4; | ||
args.forEach(function (node) { | ||
if (!_this5.ctx.isA(node)) throw new Error("del: invalid AST node argument: " + JSON.stringify(node)); | ||
if (!_this5.ctx.isA(node)) throw new Error("del: invalid AST node argument"); | ||
var found = false; | ||
@@ -598,4 +598,4 @@ for (var j = 0; j < _this5.C.length; j++) { | ||
/* global 3: false */ | ||
/* global 4: false */ | ||
/* global 20150821: false */ | ||
/* global 5: false */ | ||
/* global 20150919: false */ | ||
@@ -610,4 +610,4 @@ "use strict"; | ||
minor: 3, | ||
micro: 4, | ||
date: 20150821 | ||
micro: 5, | ||
date: 20150919 | ||
}; | ||
@@ -614,0 +614,0 @@ |
{ | ||
"name": "asty", | ||
"version": "1.3.4", | ||
"version": "1.3.5", | ||
"description": "Abstract Syntax Tree (AST) Data Structure", | ||
@@ -22,13 +22,13 @@ "keywords": [ "ast", "abstract", "syntax", "tree", "data", "structure" ], | ||
"grunt-cli": "~0.1.13", | ||
"grunt-contrib-jshint": "~0.11.2", | ||
"grunt-contrib-jshint": "~0.11.3", | ||
"grunt-contrib-clean": "~0.6.0", | ||
"grunt-browserify": "~4.0.0", | ||
"grunt-browserify": "~4.0.1", | ||
"grunt-jscs": "~2.1.0", | ||
"grunt-mocha-test": "~0.12.7", | ||
"grunt-eslint": "~17.1.0", | ||
"babel-eslint": "~4.0.10", | ||
"mocha": "~2.2.5", | ||
"babel-eslint": "~4.1.3", | ||
"mocha": "~2.3.2", | ||
"chai": "~3.2.0", | ||
"babelify": "~6.2.0", | ||
"minifyify": "~7.0.5", | ||
"babelify": "~6.3.0", | ||
"minifyify": "~7.0.6", | ||
"browserify-header": "~0.9.2", | ||
@@ -35,0 +35,0 @@ "browserify-derequire": "~0.9.4", |
@@ -142,3 +142,3 @@ /* | ||
if (!this.ctx.isA(node)) | ||
throw new Error(`ins: invalid AST node argument: ${ JSON.stringify(node) }`) | ||
throw new Error("ins: invalid AST node argument") | ||
this.C.splice(pos++, 0, node) | ||
@@ -162,3 +162,3 @@ node.P = this | ||
if (!this.ctx.isA(node)) | ||
throw new Error(`add: invalid AST node argument: ${ JSON.stringify(node) }`) | ||
throw new Error("add: invalid AST node argument") | ||
this.C.push(node) | ||
@@ -182,3 +182,3 @@ node.P = this | ||
if (!this.ctx.isA(node)) | ||
throw new Error(`del: invalid AST node argument: ${ JSON.stringify(node) }`) | ||
throw new Error("del: invalid AST node argument") | ||
let found = false | ||
@@ -185,0 +185,0 @@ for (let j = 0; j < this.C.length; j++) { |
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
145726