New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

extraction

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

extraction - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

2

lib/extraction.js

@@ -27,3 +27,3 @@ /*

(function (global){
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.ASTY=e()}}(function(){return function(){function e(n,t,r){function i(u,a){if(!t[u]){if(!n[u]){var f="function"==typeof _dereq_&&_dereq_;if(!a&&f)return f(u,!0);if(o)return o(u,!0);var l=new Error("Cannot find module '"+u+"'");throw l.code="MODULE_NOT_FOUND",l}var c=t[u]={exports:{}};n[u][0].call(c.exports,function(e){return i(n[u][1][e]||e)},c,c.exports,e,n,t,r)}return t[u].exports}for(var o="function"==typeof _dereq_&&_dereq_,u=0;u<r.length;u++)i(r[u]);return i}return e}()({1:[function(e,n,t){"use strict";function r(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i="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},o=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}}(),u=function(){function e(){r(this,e)}return o(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"===(void 0===t?"undefined":i(t)))for(var o in t)t.hasOwnProperty(o)&&this.set(o,t[o]);return"object"===(void 0===r?"undefined":i(r))&&r instanceof Array&&this.add(r),this}},{key:"create",value:function(e,n,t){return this.ctx.create(e,n,t)}},{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;r<n;r++)t[r]=arguments[r];if(1===t.length&&"object"===i(t[0]))Object.keys(t[0]).forEach(function(n){void 0!==t[0][n]?e.A[n]=t[0][n]:delete e.A[n]});else{if(2!==t.length)throw new Error("set: invalid number of arguments");void 0!==t[1]?this.A[t[0]]=t[1]:delete this.A[t[0]]}return this}},{key:"unset",value:function(){for(var e=this,n=arguments.length,t=Array(n),r=0;r<n;r++)t[r]=arguments[r];if(1===t.length&&"object"===i(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(e<0)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),o=1;o<t;o++)r[o-1]=arguments[o];if(0===r.length)throw new Error("ins: invalid number of arguments");if(e<0&&(e=this.C.length+1-e),!(e>=0&&e<=this.C.length))throw new Error("ins: invalid position");var u=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"===(void 0===e?"undefined":i(e))&&e instanceof Array?e.forEach(function(e){u(e)}):null!==e&&u(e)}),this}},{key:"add",value:function(){for(var e=this,n=arguments.length,t=Array(n),r=0;r<n;r++)t[r]=arguments[r];if(0===t.length)throw new Error("add: invalid number of arguments");var o=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"===(void 0===e?"undefined":i(e))&&e instanceof Array?e.forEach(function(e){o(e)}):null!==e&&o(e)}),this}},{key:"del",value:function(){for(var e=this,n=arguments.length,t=Array(n),r=0;r<n;r++)t[r]=arguments[r];if(0===t.length)throw new Error("del: invalid number of arguments");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(){if(arguments.length>2)throw new Error("childs: invalid number of arguments");if(2===arguments.length&&"number"==typeof(arguments.length<=0?void 0:arguments[0])&&"number"==typeof(arguments.length<=1?void 0:arguments[1]))return this.C.slice(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1]);if(1===arguments.length&&"number"==typeof(arguments.length<=0?void 0:arguments[0]))return this.C.slice(arguments.length<=0?void 0:arguments[0]);if(0===arguments.length)return this.C;throw new Error("childs: invalid type of arguments")}},{key:"child",value:function(e){if("number"!=typeof e)throw new Error("child: invalid argument");return e<this.C.length?this.C[e]:null}},{key:"parent",value:function(){return this.P}},{key:"serialize",value:function(){return this.ctx.serialize(this)}}]),e}();t.default=u},{}],2:[function(e,n,t){"use strict";function r(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i="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},o=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}}(),u={mid:{unicode:String.fromCharCode(9500),ascii:"+"},last:{unicode:String.fromCharCode(9492),ascii:"+"},down:{unicode:String.fromCharCode(9474),ascii:"|"},left:{unicode:String.fromCharCode(9472),ascii:"-"}},a=function(){function e(){r(this,e)}return o(e,[{key:"dump",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1/0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(e,n){return n},t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r="",o=this;return this.walk(function(a,f){if(!(f>e)){if(f>0){var l=function(e){var n=0,t=0;return null!==e.P&&(n=e.P.C.indexOf(e),t=e.P.C.length-1),{nth:n,max:t}},c=l(a),s=c.nth,d=c.max,h=" ";h=t?""+u.left.unicode+u.left.unicode+h:""+u.left.ascii+u.left.ascii+h,h=s<d?""+(t?u.mid.unicode:u.mid.ascii)+h:""+(t?u.last.unicode:u.last.ascii)+h;for(var y=a.P;null!==y&&y!==o;y=y.P)if(null!==y.P){var v=l(y);h=v.nth<v.max?(t?u.down.unicode:u.down.ascii)+" "+h:" "+h}r+=n("tree",h)}r+=n("type",a.T)+" ";var p=Object.keys(a.A);if(p.length>0){r+=n("parenthesis","(");var b=!0;p.forEach(function(e){b?b=!1:r+=n("comma",",")+" ",r+=n("key",e)+n("colon",":")+" ";var t=a.A[e];switch(void 0===t?"undefined":i(t)){case"boolean":case"number":r+=n("value",t.toString());break;case"string":var o=function(e){return e.charCodeAt(0).toString(16).toUpperCase()};r+=n("value",'"'+t.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":t instanceof RegExp?r+=n("value","/"+t.source+"/"):r+=n("value",JSON.stringify(t));break;default:r+=n("value",JSON.stringify(t))}}),r+=n("parenthesis",")")+" "}r+=n("position",n("bracket","[")+n("line",a.L.L)+n("slash",",")+n("column",a.L.C)+n("bracket","]")),r+="\n"}},"downward"),r}}]),e}();t.default=a},{}],3:[function(e,n,t){"use strict";function r(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=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}}(),o=function(){function e(){r(this,e)}return i(e,[{key:"merge",value:function(e){var n=this,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null===e)return this;if(!this.ctx.isA(e))throw new Error("merge: invalid AST node argument");if(t){var i=e.pos();this.pos(i.line,i.column,i.offset)}e.attrs().forEach(function(t){var i=void 0!==r[t]?r[t]:t;null!==i&&n.set(i,e.get(t))}),e.childs().forEach(function(t){e.del(t),n.add(t)});var o=e.parent();return null!==o&&o.del(e),this}}]),e}();t.default=o},{}],4:[function(e,n,t){"use strict";function r(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i="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},o=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}}(),u=function(){function e(){r(this,e)}return o(e,null,[{key:"serialize",value:function(e,n){if(!e.isA(n))throw new Error("serialize: not an ASTy node");return JSON.stringify({ASTy: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(void 0===r?"undefined":i(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}(n)})}},{key:"unserialize",value:function(e,n){var t=JSON.parse(n);if("object"!==(void 0===t?"undefined":i(t))||"object"!==i(t.ASTy))throw new Error("unserialize: not an ASTy JSON export");return function n(t){var r=e.create(t.T);return r.pos(t.L.L,t.L.C,t.L.O),"object"===i(t.A)&&Object.keys(t.A).forEach(function(e){var n=t.A[e];switch(void 0===n?"undefined":i(n)){case"boolean":case"number":case"string":r.set(e,n);break;default:r.set(e,JSON.parse(JSON.stringify(n)))}}),"object"===i(t.C)&&t.C instanceof Array&&r.add(t.C.map(function(e){return n(e)})),r}(t.ASTy)}}]),e}();t.default=u},{}],5:[function(e,n,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={major:1,minor:7,micro:4,date:20180330};t.default=r},{}],6:[function(e,n,t){"use strict";function r(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=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}}(),o=function(){function e(){r(this,e)}return i(e,[{key:"walk",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"downward";return function t(r,i,o){"downward"!==n&&"both"!==n||e(r,i,o,"downward"),r.C.forEach(function(e){t(e,i+1,r)}),"upward"!==n&&"both"!==n||e(r,i,o,"upward")}(this,0,null),this}}]),e}();t.default=o},{}],7:[function(e,n,t){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}var o="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},u=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}}(),a=e("./asty-base.js"),f=r(a),l=e("./asty-merge.js"),c=r(l),s=e("./asty-walk.js"),d=r(s),h=e("./asty-dump.js"),y=r(h),v=e("./asty-serialize.js"),p=r(v),b=e("./asty-version.js"),g=r(b),m=function(){function e(){var n=this;return i(this,e),this.ASTYNode=function(){},[[f.default,"init","create","type","pos","set","unset","get","attrs","nth","ins","add","del","childs","child","parent","serialize"],[c.default,"merge"],[d.default,"walk"],[y.default,"dump"]].forEach(function(e){var t=e[0].prototype;e.slice(1).forEach(function(e){n.ASTYNode.prototype[e]=t[e]})}),this}return u(e,[{key:"version",value:function(){return g.default}},{key:"extend",value:function(e){for(var n in e)e.hasOwnProperty(n)&&(this.ASTYNode.prototype[n]=e[n]);return this}},{key:"create",value:function(e,n,t){return(new this.ASTYNode).init(this,e,n,t)}},{key:"isA",value:function(e){return"object"===(void 0===e?"undefined":o(e))&&e instanceof this.ASTYNode&&"boolean"==typeof e.ASTy&&!0===e.ASTy}},{key:"serialize",value:function(e){return p.default.serialize(this,e)}},{key:"unserialize",value:function(e){return p.default.unserialize(this,e)}}]),e}();n.exports=m},{"./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)});
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.ASTY=e()}}(function(){return function(){function e(n,t,r){function i(u,a){if(!t[u]){if(!n[u]){var f="function"==typeof _dereq_&&_dereq_;if(!a&&f)return f(u,!0);if(o)return o(u,!0);var l=new Error("Cannot find module '"+u+"'");throw l.code="MODULE_NOT_FOUND",l}var c=t[u]={exports:{}};n[u][0].call(c.exports,function(e){return i(n[u][1][e]||e)},c,c.exports,e,n,t,r)}return t[u].exports}for(var o="function"==typeof _dereq_&&_dereq_,u=0;u<r.length;u++)i(r[u]);return i}return e}()({1:[function(e,n,t){"use strict";function r(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i="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},o=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}}(),u=function(){function e(){r(this,e)}return o(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"===(void 0===t?"undefined":i(t)))for(var o in t)t.hasOwnProperty(o)&&this.set(o,t[o]);return"object"===(void 0===r?"undefined":i(r))&&r instanceof Array&&this.add(r),this}},{key:"create",value:function(e,n,t){return this.ctx.create(e,n,t)}},{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;r<n;r++)t[r]=arguments[r];if(1===t.length&&"object"===i(t[0]))Object.keys(t[0]).forEach(function(n){void 0!==t[0][n]?e.A[n]=t[0][n]:delete e.A[n]});else{if(2!==t.length)throw new Error("set: invalid number of arguments");void 0!==t[1]?this.A[t[0]]=t[1]:delete this.A[t[0]]}return this}},{key:"unset",value:function(){for(var e=this,n=arguments.length,t=Array(n),r=0;r<n;r++)t[r]=arguments[r];if(1===t.length&&"object"===i(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(){for(var e=this,n=arguments.length,t=Array(n),r=0;r<n;r++)t[r]=arguments[r];if(1!==t.length)throw new Error("get: invalid number of arguments");if("object"===i(t[0])&&t[0]instanceof Array)return t[0].map(function(n){if("string"!=typeof n)throw new Error("get: invalid key argument");return e.A[n]});var o=t[0];if("string"!=typeof o)throw new Error("get: invalid key argument");return this.A[o]}},{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 n=this,t=arguments.length,r=Array(t>1?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];if(0===r.length)throw new Error("ins: invalid number of arguments");if(e<0&&(e=this.C.length+1-e),!(e>=0&&e<=this.C.length))throw new Error("ins: invalid position");var u=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"===(void 0===e?"undefined":i(e))&&e instanceof Array?e.forEach(function(e){u(e)}):null!==e&&u(e)}),this}},{key:"add",value:function(){for(var e=this,n=arguments.length,t=Array(n),r=0;r<n;r++)t[r]=arguments[r];if(0===t.length)throw new Error("add: invalid number of arguments");var o=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"===(void 0===e?"undefined":i(e))&&e instanceof Array?e.forEach(function(e){o(e)}):null!==e&&o(e)}),this}},{key:"del",value:function(){for(var e=this,n=arguments.length,t=Array(n),r=0;r<n;r++)t[r]=arguments[r];if(0===t.length)throw new Error("del: invalid number of arguments");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(){if(arguments.length>2)throw new Error("childs: invalid number of arguments");if(2===arguments.length&&"number"==typeof(arguments.length<=0?void 0:arguments[0])&&"number"==typeof(arguments.length<=1?void 0:arguments[1]))return this.C.slice(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1]);if(1===arguments.length&&"number"==typeof(arguments.length<=0?void 0:arguments[0]))return this.C.slice(arguments.length<=0?void 0:arguments[0]);if(0===arguments.length)return this.C;throw new Error("childs: invalid type of arguments")}},{key:"child",value:function(e){if("number"!=typeof e)throw new Error("child: invalid argument");return e<this.C.length?this.C[e]:null}},{key:"parent",value:function(){return this.P}},{key:"serialize",value:function(){return this.ctx.__serialize(this)}}]),e}();t.default=u},{}],2:[function(e,n,t){"use strict";function r(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i="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},o=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}}(),u={mid:{unicode:String.fromCharCode(9500),ascii:"+"},last:{unicode:String.fromCharCode(9492),ascii:"+"},down:{unicode:String.fromCharCode(9474),ascii:"|"},left:{unicode:String.fromCharCode(9472),ascii:"-"}},a=function(){function e(){r(this,e)}return o(e,[{key:"dump",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1/0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(e,n){return n},t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r="",o=this;return this.walk(function(a,f){if(!(f>e)){if(f>0){var l=function(e){var n=0,t=0;return null!==e.P&&(n=e.P.C.indexOf(e),t=e.P.C.length-1),{nth:n,max:t}},c=l(a),s=c.nth,d=c.max,h=" ";h=t?""+u.left.unicode+u.left.unicode+h:""+u.left.ascii+u.left.ascii+h,h=s<d?""+(t?u.mid.unicode:u.mid.ascii)+h:""+(t?u.last.unicode:u.last.ascii)+h;for(var y=a.P;null!==y&&y!==o;y=y.P)if(null!==y.P){var v=l(y);h=v.nth<v.max?(t?u.down.unicode:u.down.ascii)+" "+h:" "+h}r+=n("tree",h)}r+=n("type",a.T)+" ";var p=Object.keys(a.A);if(p.length>0){r+=n("parenthesis","(");var b=!0;p.forEach(function(e){b?b=!1:r+=n("comma",",")+" ",r+=n("key",e)+n("colon",":")+" ";var t=a.A[e];switch(void 0===t?"undefined":i(t)){case"boolean":case"number":r+=n("value",t.toString());break;case"string":var o=function(e){return e.charCodeAt(0).toString(16).toUpperCase()};r+=n("value",'"'+t.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":t instanceof RegExp?r+=n("value","/"+t.source+"/"):r+=n("value",JSON.stringify(t));break;default:r+=n("value",JSON.stringify(t))}}),r+=n("parenthesis",")")+" "}r+=n("position",n("bracket","[")+n("line",a.L.L)+n("slash",",")+n("column",a.L.C)+n("bracket","]")),r+="\n"}},"downward"),r}}]),e}();t.default=a},{}],3:[function(e,n,t){"use strict";function r(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=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}}(),o=function(){function e(){r(this,e)}return i(e,[{key:"merge",value:function(e){var n=this,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null===e)return this;if(!this.ctx.isA(e))throw new Error("merge: invalid AST node argument");if(t){var i=e.pos();this.pos(i.line,i.column,i.offset)}e.attrs().forEach(function(t){var i=void 0!==r[t]?r[t]:t;null!==i&&n.set(i,e.get(t))}),e.childs().forEach(function(t){e.del(t),n.add(t)});var o=e.parent();return null!==o&&o.del(e),this}}]),e}();t.default=o},{}],4:[function(e,n,t){"use strict";function r(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i="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},o=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}}(),u=function(){function e(){r(this,e)}return o(e,null,[{key:"serialize",value:function(e,n){if(!e.isA(n))throw new Error("serialize: not an ASTy node");return JSON.stringify({ASTy: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(void 0===r?"undefined":i(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}(n)})}},{key:"unserialize",value:function(e,n){var t=JSON.parse(n);if("object"!==(void 0===t?"undefined":i(t))||"object"!==i(t.ASTy))throw new Error("unserialize: not an ASTy JSON export");return function n(t){var r=e.create(t.T);return r.pos(t.L.L,t.L.C,t.L.O),"object"===i(t.A)&&Object.keys(t.A).forEach(function(e){var n=t.A[e];switch(void 0===n?"undefined":i(n)){case"boolean":case"number":case"string":r.set(e,n);break;default:r.set(e,JSON.parse(JSON.stringify(n)))}}),"object"===i(t.C)&&t.C instanceof Array&&r.add(t.C.map(function(e){return n(e)})),r}(t.ASTy)}}]),e}();t.default=u},{}],5:[function(e,n,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={major:1,minor:7,micro:4,date:20180330};t.default=r},{}],6:[function(e,n,t){"use strict";function r(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=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}}(),o=function(){function e(){r(this,e)}return i(e,[{key:"walk",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"downward";return function t(r,i,o){"downward"!==n&&"both"!==n||e(r,i,o,"downward"),r.C.forEach(function(e){t(e,i+1,r)}),"upward"!==n&&"both"!==n||e(r,i,o,"upward")}(this,0,null),this}}]),e}();t.default=o},{}],7:[function(e,n,t){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}var o="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},u=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}}(),a=e("./asty-base.js"),f=r(a),l=e("./asty-merge.js"),c=r(l),s=e("./asty-walk.js"),d=r(s),h=e("./asty-dump.js"),y=r(h),v=e("./asty-serialize.js"),p=r(v),b=e("./asty-version.js"),g=r(b),m=function(){function e(){var n=this;return i(this,e),this.ASTYNode=function(){},[[f.default,"init","create","type","pos","set","unset","get","attrs","nth","ins","add","del","childs","child","parent","serialize"],[c.default,"merge"],[d.default,"walk"],[y.default,"dump"]].forEach(function(e){var t=e[0].prototype;e.slice(1).forEach(function(e){n.ASTYNode.prototype[e]=t[e]})}),this}return u(e,[{key:"version",value:function(){return g.default}},{key:"extend",value:function(e){for(var n in e)e.hasOwnProperty(n)&&(this.ASTYNode.prototype[n]=e[n]);return this}},{key:"create",value:function(e,n,t){return(new this.ASTYNode).init(this,e,n,t)}},{key:"isA",value:function(e){return"object"===(void 0===e?"undefined":o(e))&&e instanceof this.ASTYNode&&"boolean"==typeof e.ASTy&&!0===e.ASTy}},{key:"__serialize",value:function(n){return e.serialize(n)}}],[{key:"serialize",value:function(e){return p.default.serialize(e.ctx,e)}},{key:"unserialize",value:function(e){return p.default.unserialize(new this,e)}}]),e}();n.exports=m},{"./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)});
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})

@@ -30,0 +30,0 @@

{
"name": "extraction",
"version": "1.0.3",
"version": "1.0.4",
"description": "Tree Extraction for JavaScript Object Graphs",

@@ -25,4 +25,4 @@ "keywords": [ "tree", "graph", "data", "structure", "extraction", "object" ],

"pegjs-util": "1.4.9",
"asty": "1.7.6",
"cache-lru": "1.1.1"
"asty": "1.7.10",
"cache-lru": "1.1.2"
},

@@ -39,3 +39,3 @@ "devDependencies": {

"eslint-config-standard": "11.0.0",
"eslint-plugin-standard": "3.0.1",
"eslint-plugin-standard": "3.1.0",
"eslint-plugin-promise": "3.7.0",

@@ -47,3 +47,3 @@ "eslint-plugin-import": "2.11.0",

"babelify": "8.0.0",
"babel-core": "6.26.0",
"babel-core": "6.26.3",
"babel-preset-es2015": "6.24.1",

@@ -53,3 +53,3 @@ "minifyify": "7.3.5",

"browserify-derequire": "0.9.4",
"source-map-support": "0.5.4"
"source-map-support": "0.5.5"
},

@@ -56,0 +56,0 @@ "scripts": {

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