ast-monkey-traverse
Advanced tools
Comparing version 3.0.10 to 3.0.11
/** | ||
* @name ast-monkey-traverse | ||
* @fileoverview Utility library to traverse AST | ||
* @version 3.0.10 | ||
* @version 3.0.11 | ||
* @author Roy Revelt, Codsen Ltd | ||
@@ -10,2 +10,2 @@ * @license MIT | ||
import p from"lodash.clonedeep";import g from"lodash.isplainobject";import{parent as m}from"ast-monkey-util";var u="3.0.10";var k=u;function D(y,c){let $={now:!1};function a(b,l,d,r){let n=p(b),s,t={depth:-1,path:"",...d};if(t.depth+=1,Array.isArray(n))for(let e=0,o=n.length;e<o&&!r.now;e++){let i=t.path?`${t.path}.${e}`:`${e}`;n[e]!==void 0?(t.parent=p(n),t.parentType="array",t.parentKey=m(i),s=a(l(n[e],void 0,{...t,path:i},r),l,{...t,path:i},r),Number.isNaN(s)&&e<n.length?(n.splice(e,1),e-=1):n[e]=s):n.splice(e,1)}else if(g(n))for(let e in n){if(r.now&&e!=null)break;let o=t.path?`${t.path}.${e}`:e;t.depth===0&&e!=null&&(t.topmostKey=e),t.parent=p(n),t.parentType="object",t.parentKey=m(o),s=a(l(e,n[e],{...t,path:o},r),l,{...t,path:o},r),Number.isNaN(s)?delete n[e]:n[e]=s}return n}return a(y,c,{},$)}export{D as traverse,k as version}; | ||
import p from"lodash.clonedeep";import g from"lodash.isplainobject";import{parent as m}from"ast-monkey-util";var u="3.0.11";var k=u;function D(y,c){let $={now:!1};function a(b,l,d,r){let n=p(b),s,t={depth:-1,path:"",...d};if(t.depth+=1,Array.isArray(n))for(let e=0,o=n.length;e<o&&!r.now;e++){let i=t.path?`${t.path}.${e}`:`${e}`;n[e]!==void 0?(t.parent=p(n),t.parentType="array",t.parentKey=m(i),s=a(l(n[e],void 0,{...t,path:i},r),l,{...t,path:i},r),Number.isNaN(s)&&e<n.length?(n.splice(e,1),e-=1):n[e]=s):n.splice(e,1)}else if(g(n))for(let e in n){if(r.now&&e!=null)break;let o=t.path?`${t.path}.${e}`:e;t.depth===0&&e!=null&&(t.topmostKey=e),t.parent=p(n),t.parentType="object",t.parentKey=m(o),s=a(l(e,n[e],{...t,path:o},r),l,{...t,path:o},r),Number.isNaN(s)?delete n[e]:n[e]=s}return n}return a(y,c,{},$)}export{D as traverse,k as version}; |
/** | ||
* @name ast-monkey-traverse | ||
* @fileoverview Utility library to traverse AST | ||
* @version 3.0.10 | ||
* @version 3.0.11 | ||
* @author Roy Revelt, Codsen Ltd | ||
@@ -10,7 +10,7 @@ * @license MIT | ||
var astMonkeyTraverse=(()=>{var re=Object.create;var x=Object.defineProperty,oe=Object.defineProperties,ae=Object.getOwnPropertyDescriptor,ie=Object.getOwnPropertyDescriptors,se=Object.getOwnPropertyNames,nt=Object.getOwnPropertySymbols,ce=Object.getPrototypeOf,rt=Object.prototype.hasOwnProperty,ue=Object.prototype.propertyIsEnumerable;var ot=(t,e,n)=>e in t?x(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,v=(t,e)=>{for(var n in e||(e={}))rt.call(e,n)&&ot(t,n,e[n]);if(nt)for(var n of nt(e))ue.call(e,n)&&ot(t,n,e[n]);return t},w=(t,e)=>oe(t,ie(e)),at=t=>x(t,"__esModule",{value:!0});var it=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),le=(t,e)=>{for(var n in e)x(t,n,{get:e[n],enumerable:!0})},st=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of se(e))!rt.call(t,o)&&(n||o!=="default")&&x(t,o,{get:()=>e[o],enumerable:!(r=ae(e,o))||r.enumerable});return t},ct=(t,e)=>st(at(x(t!=null?re(ce(t)):{},"default",!e&&t&&t.__esModule?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t),fe=(t=>(e,n)=>t&&t.get(e)||(n=st(at({}),e,1),t&&t.set(e,n),n))(typeof WeakMap!="undefined"?new WeakMap:0);var Xt=it((C,T)=>{var pe=200,ut="__lodash_hash_undefined__",lt=9007199254740991,k="[object Arguments]",de="[object Array]",ft="[object Boolean]",pt="[object Date]",he="[object Error]",F="[object Function]",dt="[object GeneratorFunction]",P="[object Map]",ht="[object Number]",H="[object Object]",gt="[object Promise]",bt="[object RegExp]",D="[object Set]",yt="[object String]",_t="[object Symbol]",L="[object WeakMap]",mt="[object ArrayBuffer]",N="[object DataView]",$t="[object Float32Array]",vt="[object Float64Array]",Ot="[object Int8Array]",jt="[object Int16Array]",St="[object Int32Array]",Tt="[object Uint8Array]",xt="[object Uint8ClampedArray]",wt="[object Uint16Array]",At="[object Uint32Array]",ge=/[\\^$.*+?()[\]{}|]/g,be=/\w*$/,ye=/^\[object .+?Constructor\]$/,_e=/^(?:0|[1-9]\d*)$/,a={};a[k]=a[de]=a[mt]=a[N]=a[ft]=a[pt]=a[$t]=a[vt]=a[Ot]=a[jt]=a[St]=a[P]=a[ht]=a[H]=a[bt]=a[D]=a[yt]=a[_t]=a[Tt]=a[xt]=a[wt]=a[At]=!0;a[he]=a[F]=a[L]=!1;var me=typeof global=="object"&&global&&global.Object===Object&&global,$e=typeof self=="object"&&self&&self.Object===Object&&self,d=me||$e||Function("return this")(),Et=typeof C=="object"&&C&&!C.nodeType&&C,Ct=Et&&typeof T=="object"&&T&&!T.nodeType&&T,ve=Ct&&Ct.exports===Et;function Oe(t,e){return t.set(e[0],e[1]),t}function je(t,e){return t.add(e),t}function Se(t,e){for(var n=-1,r=t?t.length:0;++n<r&&e(t[n],n,t)!==!1;);return t}function Te(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t}function It(t,e,n,r){var o=-1,c=t?t.length:0;for(r&&c&&(n=t[++o]);++o<c;)n=e(n,t[o],o,t);return n}function xe(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}function we(t,e){return t==null?void 0:t[e]}function Pt(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch(n){}return e}function Dt(t){var e=-1,n=Array(t.size);return t.forEach(function(r,o){n[++e]=[o,r]}),n}function U(t,e){return function(n){return t(e(n))}}function Nt(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}var Ae=Array.prototype,Ee=Function.prototype,K=Object.prototype,J=d["__core-js_shared__"],Kt=function(){var t=/[^.]+$/.exec(J&&J.keys&&J.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),Vt=Ee.toString,b=K.hasOwnProperty,V=K.toString,Ce=RegExp("^"+Vt.call(b).replace(ge,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Mt=ve?d.Buffer:void 0,Rt=d.Symbol,Bt=d.Uint8Array,Ie=U(Object.getPrototypeOf,Object),Pe=Object.create,De=K.propertyIsEnumerable,Ne=Ae.splice,Gt=Object.getOwnPropertySymbols,Ke=Mt?Mt.isBuffer:void 0,Ve=U(Object.keys,Object),W=S(d,"DataView"),A=S(d,"Map"),q=S(d,"Promise"),Y=S(d,"Set"),X=S(d,"WeakMap"),E=S(Object,"create"),Me=$(W),Re=$(A),Be=$(q),Ge=$(Y),ke=$(X),kt=Rt?Rt.prototype:void 0,Ft=kt?kt.valueOf:void 0;function _(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Fe(){this.__data__=E?E(null):{}}function He(t){return this.has(t)&&delete this.__data__[t]}function Le(t){var e=this.__data__;if(E){var n=e[t];return n===ut?void 0:n}return b.call(e,t)?e[t]:void 0}function Ue(t){var e=this.__data__;return E?e[t]!==void 0:b.call(e,t)}function Je(t,e){var n=this.__data__;return n[t]=E&&e===void 0?ut:e,this}_.prototype.clear=Fe;_.prototype.delete=He;_.prototype.get=Le;_.prototype.has=Ue;_.prototype.set=Je;function h(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function We(){this.__data__=[]}function qe(t){var e=this.__data__,n=M(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():Ne.call(e,n,1),!0}function Ye(t){var e=this.__data__,n=M(e,t);return n<0?void 0:e[n][1]}function Xe(t){return M(this.__data__,t)>-1}function Ze(t,e){var n=this.__data__,r=M(n,t);return r<0?n.push([t,e]):n[r][1]=e,this}h.prototype.clear=We;h.prototype.delete=qe;h.prototype.get=Ye;h.prototype.has=Xe;h.prototype.set=Ze;function O(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Qe(){this.__data__={hash:new _,map:new(A||h),string:new _}}function ze(t){return R(this,t).delete(t)}function tn(t){return R(this,t).get(t)}function en(t){return R(this,t).has(t)}function nn(t,e){return R(this,t).set(t,e),this}O.prototype.clear=Qe;O.prototype.delete=ze;O.prototype.get=tn;O.prototype.has=en;O.prototype.set=nn;function j(t){this.__data__=new h(t)}function rn(){this.__data__=new h}function on(t){return this.__data__.delete(t)}function an(t){return this.__data__.get(t)}function sn(t){return this.__data__.has(t)}function cn(t,e){var n=this.__data__;if(n instanceof h){var r=n.__data__;if(!A||r.length<pe-1)return r.push([t,e]),this;n=this.__data__=new O(r)}return n.set(t,e),this}j.prototype.clear=rn;j.prototype.delete=on;j.prototype.get=an;j.prototype.has=sn;j.prototype.set=cn;function un(t,e){var n=z(t)||Dn(t)?xe(t.length,String):[],r=n.length,o=!!r;for(var c in t)(e||b.call(t,c))&&!(o&&(c=="length"||En(c,r)))&&n.push(c);return n}function Ht(t,e,n){var r=t[e];(!(b.call(t,e)&&Wt(r,n))||n===void 0&&!(e in t))&&(t[e]=n)}function M(t,e){for(var n=t.length;n--;)if(Wt(t[n][0],e))return n;return-1}function ln(t,e){return t&&Lt(e,tt(e),t)}function Z(t,e,n,r,o,c,f){var s;if(r&&(s=c?r(t,o,c,f):r(t)),s!==void 0)return s;if(!B(t))return t;var l=z(t);if(l){if(s=xn(t),!e)return jn(t,s)}else{var p=m(t),u=p==F||p==dt;if(Kn(t))return bn(t,e);if(p==H||p==k||u&&!c){if(Pt(t))return c?t:{};if(s=wn(u?{}:t),!e)return Sn(t,ln(s,t))}else{if(!a[p])return c?t:{};s=An(t,p,Z,e)}}f||(f=new j);var i=f.get(t);if(i)return i;if(f.set(t,s),!l)var g=n?Tn(t):tt(t);return Se(g||t,function(y,I){g&&(I=y,y=t[I]),Ht(s,I,Z(y,e,n,r,I,t,f))}),s}function fn(t){return B(t)?Pe(t):{}}function pn(t,e,n){var r=e(t);return z(t)?r:Te(r,n(t))}function dn(t){return V.call(t)}function hn(t){if(!B(t)||In(t))return!1;var e=Yt(t)||Pt(t)?Ce:ye;return e.test($(t))}function gn(t){if(!Jt(t))return Ve(t);var e=[];for(var n in Object(t))b.call(t,n)&&n!="constructor"&&e.push(n);return e}function bn(t,e){if(e)return t.slice();var n=new t.constructor(t.length);return t.copy(n),n}function Q(t){var e=new t.constructor(t.byteLength);return new Bt(e).set(new Bt(t)),e}function yn(t,e){var n=e?Q(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}function _n(t,e,n){var r=e?n(Dt(t),!0):Dt(t);return It(r,Oe,new t.constructor)}function mn(t){var e=new t.constructor(t.source,be.exec(t));return e.lastIndex=t.lastIndex,e}function $n(t,e,n){var r=e?n(Nt(t),!0):Nt(t);return It(r,je,new t.constructor)}function vn(t){return Ft?Object(Ft.call(t)):{}}function On(t,e){var n=e?Q(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function jn(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}function Lt(t,e,n,r){n||(n={});for(var o=-1,c=e.length;++o<c;){var f=e[o],s=r?r(n[f],t[f],f,n,t):void 0;Ht(n,f,s===void 0?t[f]:s)}return n}function Sn(t,e){return Lt(t,Ut(t),e)}function Tn(t){return pn(t,tt,Ut)}function R(t,e){var n=t.__data__;return Cn(e)?n[typeof e=="string"?"string":"hash"]:n.map}function S(t,e){var n=we(t,e);return hn(n)?n:void 0}var Ut=Gt?U(Gt,Object):Rn,m=dn;(W&&m(new W(new ArrayBuffer(1)))!=N||A&&m(new A)!=P||q&&m(q.resolve())!=gt||Y&&m(new Y)!=D||X&&m(new X)!=L)&&(m=function(t){var e=V.call(t),n=e==H?t.constructor:void 0,r=n?$(n):void 0;if(r)switch(r){case Me:return N;case Re:return P;case Be:return gt;case Ge:return D;case ke:return L}return e});function xn(t){var e=t.length,n=t.constructor(e);return e&&typeof t[0]=="string"&&b.call(t,"index")&&(n.index=t.index,n.input=t.input),n}function wn(t){return typeof t.constructor=="function"&&!Jt(t)?fn(Ie(t)):{}}function An(t,e,n,r){var o=t.constructor;switch(e){case mt:return Q(t);case ft:case pt:return new o(+t);case N:return yn(t,r);case $t:case vt:case Ot:case jt:case St:case Tt:case xt:case wt:case At:return On(t,r);case P:return _n(t,r,n);case ht:case yt:return new o(t);case bt:return mn(t);case D:return $n(t,r,n);case _t:return vn(t)}}function En(t,e){return e=e==null?lt:e,!!e&&(typeof t=="number"||_e.test(t))&&t>-1&&t%1==0&&t<e}function Cn(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function In(t){return!!Kt&&Kt in t}function Jt(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||K;return t===n}function $(t){if(t!=null){try{return Vt.call(t)}catch(e){}try{return t+""}catch(e){}}return""}function Pn(t){return Z(t,!0,!0)}function Wt(t,e){return t===e||t!==t&&e!==e}function Dn(t){return Nn(t)&&b.call(t,"callee")&&(!De.call(t,"callee")||V.call(t)==k)}var z=Array.isArray;function qt(t){return t!=null&&Vn(t.length)&&!Yt(t)}function Nn(t){return Mn(t)&&qt(t)}var Kn=Ke||Bn;function Yt(t){var e=B(t)?V.call(t):"";return e==F||e==dt}function Vn(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=lt}function B(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function Mn(t){return!!t&&typeof t=="object"}function tt(t){return qt(t)?un(t):gn(t)}function Rn(){return[]}function Bn(){return!1}T.exports=Pn});var te=it((nr,zt)=>{var Gn="[object Object]";function kn(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch(n){}return e}function Fn(t,e){return function(n){return t(e(n))}}var Hn=Function.prototype,Zt=Object.prototype,Qt=Hn.toString,Ln=Zt.hasOwnProperty,Un=Qt.call(Object),Jn=Zt.toString,Wn=Fn(Object.getPrototypeOf,Object);function qn(t){return!!t&&typeof t=="object"}function Yn(t){if(!qn(t)||Jn.call(t)!=Gn||kn(t))return!1;var e=Wn(t);if(e===null)return!0;var n=Ln.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&Qt.call(n)==Un}zt.exports=Yn});var tr={};le(tr,{traverse:()=>zn,version:()=>Qn});var G=ct(Xt(),1),ne=ct(te(),1);function Xn(t){if(t.includes(".")){let e=t.lastIndexOf(".");if(!t.slice(0,e).includes("."))return t.slice(0,e);for(let n=e-1;n--;)if(t[n]===".")return t.slice(n+1,e)}return null}var et=Xn;var ee="3.0.10";var Qn=ee;function zn(t,e){let n={now:!1};function r(o,c,f,s){let l=(0,G.default)(o),p,u=v({depth:-1,path:""},f);if(u.depth+=1,Array.isArray(l))for(let i=0,g=l.length;i<g&&!s.now;i++){let y=u.path?`${u.path}.${i}`:`${i}`;l[i]!==void 0?(u.parent=(0,G.default)(l),u.parentType="array",u.parentKey=et(y),p=r(c(l[i],void 0,w(v({},u),{path:y}),s),c,w(v({},u),{path:y}),s),Number.isNaN(p)&&i<l.length?(l.splice(i,1),i-=1):l[i]=p):l.splice(i,1)}else if((0,ne.default)(l))for(let i in l){if(s.now&&i!=null)break;let g=u.path?`${u.path}.${i}`:i;u.depth===0&&i!=null&&(u.topmostKey=i),u.parent=(0,G.default)(l),u.parentType="object",u.parentKey=et(g),p=r(c(i,l[i],w(v({},u),{path:g}),s),c,w(v({},u),{path:g}),s),Number.isNaN(p)?delete l[i]:l[i]=p}return l}return r(t,e,{},n)}return fe(tr);})(); | ||
var astMonkeyTraverse=(()=>{var ne=Object.create;var T=Object.defineProperty,oe=Object.defineProperties,ae=Object.getOwnPropertyDescriptor,ie=Object.getOwnPropertyDescriptors,se=Object.getOwnPropertyNames,rt=Object.getOwnPropertySymbols,ce=Object.getPrototypeOf,nt=Object.prototype.hasOwnProperty,ue=Object.prototype.propertyIsEnumerable;var ot=(t,e,r)=>e in t?T(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,v=(t,e)=>{for(var r in e||(e={}))nt.call(e,r)&&ot(t,r,e[r]);if(rt)for(var r of rt(e))ue.call(e,r)&&ot(t,r,e[r]);return t},w=(t,e)=>oe(t,ie(e)),at=t=>T(t,"__esModule",{value:!0});var it=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),le=(t,e)=>{for(var r in e)T(t,r,{get:e[r],enumerable:!0})},st=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of se(e))!nt.call(t,o)&&(r||o!=="default")&&T(t,o,{get:()=>e[o],enumerable:!(n=ae(e,o))||n.enumerable});return t},ct=(t,e)=>st(at(T(t!=null?ne(ce(t)):{},"default",!e&&t&&t.__esModule?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t),fe=(t=>(e,r)=>t&&t.get(e)||(r=st(at({}),e,1),t&&t.set(e,r),r))(typeof WeakMap!="undefined"?new WeakMap:0);var Xt=it((C,x)=>{var pe=200,ut="__lodash_hash_undefined__",lt=9007199254740991,k="[object Arguments]",de="[object Array]",ft="[object Boolean]",pt="[object Date]",he="[object Error]",F="[object Function]",dt="[object GeneratorFunction]",P="[object Map]",ht="[object Number]",H="[object Object]",gt="[object Promise]",yt="[object RegExp]",D="[object Set]",bt="[object String]",_t="[object Symbol]",L="[object WeakMap]",mt="[object ArrayBuffer]",N="[object DataView]",$t="[object Float32Array]",vt="[object Float64Array]",Ot="[object Int8Array]",jt="[object Int16Array]",St="[object Int32Array]",xt="[object Uint8Array]",Tt="[object Uint8ClampedArray]",wt="[object Uint16Array]",At="[object Uint32Array]",ge=/[\\^$.*+?()[\]{}|]/g,ye=/\w*$/,be=/^\[object .+?Constructor\]$/,_e=/^(?:0|[1-9]\d*)$/,a={};a[k]=a[de]=a[mt]=a[N]=a[ft]=a[pt]=a[$t]=a[vt]=a[Ot]=a[jt]=a[St]=a[P]=a[ht]=a[H]=a[yt]=a[D]=a[bt]=a[_t]=a[xt]=a[Tt]=a[wt]=a[At]=!0;a[he]=a[F]=a[L]=!1;var me=typeof global=="object"&&global&&global.Object===Object&&global,$e=typeof self=="object"&&self&&self.Object===Object&&self,d=me||$e||Function("return this")(),Et=typeof C=="object"&&C&&!C.nodeType&&C,Ct=Et&&typeof x=="object"&&x&&!x.nodeType&&x,ve=Ct&&Ct.exports===Et;function Oe(t,e){return t.set(e[0],e[1]),t}function je(t,e){return t.add(e),t}function Se(t,e){for(var r=-1,n=t?t.length:0;++r<n&&e(t[r],r,t)!==!1;);return t}function xe(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}function It(t,e,r,n){var o=-1,c=t?t.length:0;for(n&&c&&(r=t[++o]);++o<c;)r=e(r,t[o],o,t);return r}function Te(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function we(t,e){return t==null?void 0:t[e]}function Pt(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch(r){}return e}function Dt(t){var e=-1,r=Array(t.size);return t.forEach(function(n,o){r[++e]=[o,n]}),r}function U(t,e){return function(r){return t(e(r))}}function Nt(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var Ae=Array.prototype,Ee=Function.prototype,K=Object.prototype,J=d["__core-js_shared__"],Kt=function(){var t=/[^.]+$/.exec(J&&J.keys&&J.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),Vt=Ee.toString,y=K.hasOwnProperty,V=K.toString,Ce=RegExp("^"+Vt.call(y).replace(ge,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Mt=ve?d.Buffer:void 0,Rt=d.Symbol,Bt=d.Uint8Array,Ie=U(Object.getPrototypeOf,Object),Pe=Object.create,De=K.propertyIsEnumerable,Ne=Ae.splice,Gt=Object.getOwnPropertySymbols,Ke=Mt?Mt.isBuffer:void 0,Ve=U(Object.keys,Object),W=S(d,"DataView"),A=S(d,"Map"),q=S(d,"Promise"),Y=S(d,"Set"),X=S(d,"WeakMap"),E=S(Object,"create"),Me=$(W),Re=$(A),Be=$(q),Ge=$(Y),ke=$(X),kt=Rt?Rt.prototype:void 0,Ft=kt?kt.valueOf:void 0;function _(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Fe(){this.__data__=E?E(null):{}}function He(t){return this.has(t)&&delete this.__data__[t]}function Le(t){var e=this.__data__;if(E){var r=e[t];return r===ut?void 0:r}return y.call(e,t)?e[t]:void 0}function Ue(t){var e=this.__data__;return E?e[t]!==void 0:y.call(e,t)}function Je(t,e){var r=this.__data__;return r[t]=E&&e===void 0?ut:e,this}_.prototype.clear=Fe;_.prototype.delete=He;_.prototype.get=Le;_.prototype.has=Ue;_.prototype.set=Je;function h(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function We(){this.__data__=[]}function qe(t){var e=this.__data__,r=M(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():Ne.call(e,r,1),!0}function Ye(t){var e=this.__data__,r=M(e,t);return r<0?void 0:e[r][1]}function Xe(t){return M(this.__data__,t)>-1}function Ze(t,e){var r=this.__data__,n=M(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}h.prototype.clear=We;h.prototype.delete=qe;h.prototype.get=Ye;h.prototype.has=Xe;h.prototype.set=Ze;function O(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Qe(){this.__data__={hash:new _,map:new(A||h),string:new _}}function ze(t){return R(this,t).delete(t)}function tr(t){return R(this,t).get(t)}function er(t){return R(this,t).has(t)}function rr(t,e){return R(this,t).set(t,e),this}O.prototype.clear=Qe;O.prototype.delete=ze;O.prototype.get=tr;O.prototype.has=er;O.prototype.set=rr;function j(t){this.__data__=new h(t)}function nr(){this.__data__=new h}function or(t){return this.__data__.delete(t)}function ar(t){return this.__data__.get(t)}function ir(t){return this.__data__.has(t)}function sr(t,e){var r=this.__data__;if(r instanceof h){var n=r.__data__;if(!A||n.length<pe-1)return n.push([t,e]),this;r=this.__data__=new O(n)}return r.set(t,e),this}j.prototype.clear=nr;j.prototype.delete=or;j.prototype.get=ar;j.prototype.has=ir;j.prototype.set=sr;function cr(t,e){var r=z(t)||Pr(t)?Te(t.length,String):[],n=r.length,o=!!n;for(var c in t)(e||y.call(t,c))&&!(o&&(c=="length"||Ar(c,n)))&&r.push(c);return r}function Ht(t,e,r){var n=t[e];(!(y.call(t,e)&&Wt(n,r))||r===void 0&&!(e in t))&&(t[e]=r)}function M(t,e){for(var r=t.length;r--;)if(Wt(t[r][0],e))return r;return-1}function ur(t,e){return t&&Lt(e,tt(e),t)}function Z(t,e,r,n,o,c,f){var s;if(n&&(s=c?n(t,o,c,f):n(t)),s!==void 0)return s;if(!B(t))return t;var l=z(t);if(l){if(s=xr(t),!e)return Or(t,s)}else{var p=m(t),u=p==F||p==dt;if(Nr(t))return gr(t,e);if(p==H||p==k||u&&!c){if(Pt(t))return c?t:{};if(s=Tr(u?{}:t),!e)return jr(t,ur(s,t))}else{if(!a[p])return c?t:{};s=wr(t,p,Z,e)}}f||(f=new j);var i=f.get(t);if(i)return i;if(f.set(t,s),!l)var g=r?Sr(t):tt(t);return Se(g||t,function(b,I){g&&(I=b,b=t[I]),Ht(s,I,Z(b,e,r,n,I,t,f))}),s}function lr(t){return B(t)?Pe(t):{}}function fr(t,e,r){var n=e(t);return z(t)?n:xe(n,r(t))}function pr(t){return V.call(t)}function dr(t){if(!B(t)||Cr(t))return!1;var e=Yt(t)||Pt(t)?Ce:be;return e.test($(t))}function hr(t){if(!Jt(t))return Ve(t);var e=[];for(var r in Object(t))y.call(t,r)&&r!="constructor"&&e.push(r);return e}function gr(t,e){if(e)return t.slice();var r=new t.constructor(t.length);return t.copy(r),r}function Q(t){var e=new t.constructor(t.byteLength);return new Bt(e).set(new Bt(t)),e}function yr(t,e){var r=e?Q(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}function br(t,e,r){var n=e?r(Dt(t),!0):Dt(t);return It(n,Oe,new t.constructor)}function _r(t){var e=new t.constructor(t.source,ye.exec(t));return e.lastIndex=t.lastIndex,e}function mr(t,e,r){var n=e?r(Nt(t),!0):Nt(t);return It(n,je,new t.constructor)}function $r(t){return Ft?Object(Ft.call(t)):{}}function vr(t,e){var r=e?Q(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}function Or(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}function Lt(t,e,r,n){r||(r={});for(var o=-1,c=e.length;++o<c;){var f=e[o],s=n?n(r[f],t[f],f,r,t):void 0;Ht(r,f,s===void 0?t[f]:s)}return r}function jr(t,e){return Lt(t,Ut(t),e)}function Sr(t){return fr(t,tt,Ut)}function R(t,e){var r=t.__data__;return Er(e)?r[typeof e=="string"?"string":"hash"]:r.map}function S(t,e){var r=we(t,e);return dr(r)?r:void 0}var Ut=Gt?U(Gt,Object):Mr,m=pr;(W&&m(new W(new ArrayBuffer(1)))!=N||A&&m(new A)!=P||q&&m(q.resolve())!=gt||Y&&m(new Y)!=D||X&&m(new X)!=L)&&(m=function(t){var e=V.call(t),r=e==H?t.constructor:void 0,n=r?$(r):void 0;if(n)switch(n){case Me:return N;case Re:return P;case Be:return gt;case Ge:return D;case ke:return L}return e});function xr(t){var e=t.length,r=t.constructor(e);return e&&typeof t[0]=="string"&&y.call(t,"index")&&(r.index=t.index,r.input=t.input),r}function Tr(t){return typeof t.constructor=="function"&&!Jt(t)?lr(Ie(t)):{}}function wr(t,e,r,n){var o=t.constructor;switch(e){case mt:return Q(t);case ft:case pt:return new o(+t);case N:return yr(t,n);case $t:case vt:case Ot:case jt:case St:case xt:case Tt:case wt:case At:return vr(t,n);case P:return br(t,n,r);case ht:case bt:return new o(t);case yt:return _r(t);case D:return mr(t,n,r);case _t:return $r(t)}}function Ar(t,e){return e=e==null?lt:e,!!e&&(typeof t=="number"||_e.test(t))&&t>-1&&t%1==0&&t<e}function Er(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function Cr(t){return!!Kt&&Kt in t}function Jt(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||K;return t===r}function $(t){if(t!=null){try{return Vt.call(t)}catch(e){}try{return t+""}catch(e){}}return""}function Ir(t){return Z(t,!0,!0)}function Wt(t,e){return t===e||t!==t&&e!==e}function Pr(t){return Dr(t)&&y.call(t,"callee")&&(!De.call(t,"callee")||V.call(t)==k)}var z=Array.isArray;function qt(t){return t!=null&&Kr(t.length)&&!Yt(t)}function Dr(t){return Vr(t)&&qt(t)}var Nr=Ke||Rr;function Yt(t){var e=B(t)?V.call(t):"";return e==F||e==dt}function Kr(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=lt}function B(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function Vr(t){return!!t&&typeof t=="object"}function tt(t){return qt(t)?cr(t):hr(t)}function Mr(){return[]}function Rr(){return!1}x.exports=Ir});var te=it((en,zt)=>{var Br="[object Object]";function Gr(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch(r){}return e}function kr(t,e){return function(r){return t(e(r))}}var Fr=Function.prototype,Zt=Object.prototype,Qt=Fr.toString,Hr=Zt.hasOwnProperty,Lr=Qt.call(Object),Ur=Zt.toString,Jr=kr(Object.getPrototypeOf,Object);function Wr(t){return!!t&&typeof t=="object"}function qr(t){if(!Wr(t)||Ur.call(t)!=Br||Gr(t))return!1;var e=Jr(t);if(e===null)return!0;var r=Hr.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&Qt.call(r)==Lr}zt.exports=qr});var zr={};le(zr,{traverse:()=>Qr,version:()=>Zr});var G=ct(Xt(),1),re=ct(te(),1);function Yr(t){if(t.includes(".")){let e=t.lastIndexOf(".");if(!t.slice(0,e).includes("."))return t.slice(0,e);for(let r=e-1;r--;)if(t[r]===".")return t.slice(r+1,e)}return null}var et=Yr;var ee="3.0.11";var Zr=ee;function Qr(t,e){let r={now:!1};function n(o,c,f,s){let l=(0,G.default)(o),p,u=v({depth:-1,path:""},f);if(u.depth+=1,Array.isArray(l))for(let i=0,g=l.length;i<g&&!s.now;i++){let b=u.path?`${u.path}.${i}`:`${i}`;l[i]!==void 0?(u.parent=(0,G.default)(l),u.parentType="array",u.parentKey=et(b),p=n(c(l[i],void 0,w(v({},u),{path:b}),s),c,w(v({},u),{path:b}),s),Number.isNaN(p)&&i<l.length?(l.splice(i,1),i-=1):l[i]=p):l.splice(i,1)}else if((0,re.default)(l))for(let i in l){if(s.now&&i!=null)break;let g=u.path?`${u.path}.${i}`:i;u.depth===0&&i!=null&&(u.topmostKey=i),u.parent=(0,G.default)(l),u.parentType="object",u.parentKey=et(g),p=n(c(i,l[i],w(v({},u),{path:g}),s),c,w(v({},u),{path:g}),s),Number.isNaN(p)?delete l[i]:l[i]=p}return l}return n(t,e,{},r)}return fe(zr);})(); | ||
/** | ||
* @name ast-monkey-util | ||
* @fileoverview Utility library of AST helper functions | ||
* @version 2.0.10 | ||
* @version 2.0.11 | ||
* @author Roy Revelt, Codsen Ltd | ||
@@ -17,0 +17,0 @@ * @license MIT |
{ | ||
"name": "ast-monkey-traverse", | ||
"version": "3.0.10", | ||
"version": "3.0.11", | ||
"description": "Utility library to traverse AST", | ||
@@ -49,3 +49,3 @@ "keywords": [ | ||
"dev": "DEV=true node '../../ops/scripts/esbuild.js' && yarn run dts", | ||
"dts": "rollup -c", | ||
"dts": "rollup -c && yarn run prettier 'types/index.d.ts' --write", | ||
"examples": "node '../../ops/scripts/run-examples.js'", | ||
@@ -57,2 +57,4 @@ "lect": "node '../../ops/lect/lect.js'", | ||
"prepare": "echo 'ready'", | ||
"prettier": "prettier", | ||
"prettier:format": "prettier --write '**/*.{ts,tsx,md}' --no-error-on-unmatched-pattern", | ||
"pretest": "yarn run lect && yarn run build", | ||
@@ -80,3 +82,3 @@ "test": "c8 yarn run unit && yarn run examples && yarn run lint", | ||
"dependencies": { | ||
"ast-monkey-util": "^2.0.10", | ||
"ast-monkey-util": "^2.0.11", | ||
"lodash.clonedeep": "^4.5.0", | ||
@@ -83,0 +85,0 @@ "lodash.isplainobject": "^4.0.6" |
@@ -29,3 +29,3 @@ # ast-monkey-traverse | ||
This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required: | ||
The latest version is **ESM only**: Node 12+ is needed to use it and it must be `import`ed instead of `require`d. If your project is not on ESM yet and you want to use `require`, use an older version of this program, `2.1.0`. | ||
@@ -36,4 +36,2 @@ ```bash | ||
If you need a legacy version which works with `require`, use version 2.1.0 | ||
## Quick Take | ||
@@ -96,6 +94,4 @@ | ||
Copyright (c) 2010-2021 Roy Revelt and other contributors | ||
Copyright (c) 2010-2022 Roy Revelt and other contributors | ||
<img src="https://codsen.com/images/png-codsen-ok.png" width="98" alt="ok" align="center"> <img src="https://codsen.com/images/png-codsen-1.png" width="148" alt="codsen" align="center"> <img src="https://codsen.com/images/png-codsen-star-small.png" width="32" alt="star" align="center"> | ||
declare const version: string; | ||
interface Stop { | ||
now: boolean; | ||
now: boolean; | ||
} | ||
interface InnerObj { | ||
depth: number; | ||
path: string; | ||
topmostKey: string; | ||
parent: any; | ||
parentType: string; | ||
parentKey: string | null; | ||
depth: number; | ||
path: string; | ||
topmostKey: string; | ||
parent: any; | ||
parentType: string; | ||
parentKey: string | null; | ||
} | ||
declare type Callback = (key: string, val: any, innerObj: InnerObj, stop: Stop) => any; | ||
declare type Callback = ( | ||
key: string, | ||
val: any, | ||
innerObj: InnerObj, | ||
stop: Stop | ||
) => any; | ||
/** | ||
@@ -15,0 +20,0 @@ * Utility library to traverse AST |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
25607
177
0
95
Updatedast-monkey-util@^2.0.11