ast-loose-compare 4.0.1 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [4.0.2](https://github.com/codsen/codsen/compare/ast-loose-compare@4.0.1...ast-loose-compare@4.0.2) (2022-12-06)
7
+
8
+ **Note:** Version bump only for package ast-loose-compare
9
+
6
10
  ## 4.0.0 (2022-12-01)
7
11
 
8
12
  ### BREAKING CHANGES
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @name ast-loose-compare
3
+ * @fileoverview Compare anything: AST, objects, arrays and strings
4
+ * @version 4.0.2
5
+ * @author Roy Revelt, Codsen Ltd
6
+ * @license MIT
7
+ * {@link https://codsen.com/os/ast-loose-compare/}
8
+ */
9
+
10
+ import{empty as r}from"ast-contains-only-empty-space";import p from"lodash.isplainobject";var l="4.0.2";var m=l;function a(t,e,s){function u(o){return o!=null}let n,i;if(s===void 0){if(!u(t)||!u(e))return}else if(!u(t)||!u(e))return!1;if(s=s||!0,typeof t!=typeof e)return!!(r(t)&&r(e));if(Array.isArray(t)&&Array.isArray(e))if(e.length){for(n=0,i=e.length;n<i;n++)if(Array.isArray(e[n])||p(e[n])){if(s=a(t[n],e[n],s),!s)return!1}else if(e[n]!==t[n])return!!(r(e[n])&&r(t[n]))}else return!!(e.length===0&&t.length===0||r(e)&&r(t));else if(p(t)&&p(e))if(Object.keys(e).length){let o=Object.keys(e);for(n=0,i=o.length;n<i;n++)if(Array.isArray(e[o[n]])||p(e[o[n]])||typeof e[o[n]]=="string"){if(s=a(t[o[n]],e[o[n]],s),!s)return!1}else if(e[o[n]]!==t[o[n]]&&(!r(e[o[n]])||!r(t[o[n]])))return!1}else return!!(Object.keys(e).length===0&&Object.keys(t).length===0||r(e)&&r(t));else if(typeof t=="string"&&typeof e=="string"){if(t!==e)return!!(r(e)&&r(t))}else return!!(r(e)&&r(t));return s}function k(t,e){return a(t,e)}export{k as looseCompare,m as version};
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @name ast-loose-compare
3
+ * @fileoverview Compare anything: AST, objects, arrays and strings
4
+ * @version 4.0.2
5
+ * @author Roy Revelt, Codsen Ltd
6
+ * @license MIT
7
+ * {@link https://codsen.com/os/ast-loose-compare/}
8
+ */
9
+
10
+ "use strict";var astLooseCompare=(()=>{var ae=Object.create;var j=Object.defineProperty,se=Object.defineProperties,ce=Object.getOwnPropertyDescriptor,ue=Object.getOwnPropertyDescriptors,fe=Object.getOwnPropertyNames,st=Object.getOwnPropertySymbols,le=Object.getPrototypeOf,ut=Object.prototype.hasOwnProperty,pe=Object.prototype.propertyIsEnumerable;var ct=(t,e,n)=>e in t?j(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,x=(t,e)=>{for(var n in e||(e={}))ut.call(e,n)&&ct(t,n,e[n]);if(st)for(var n of st(e))pe.call(e,n)&&ct(t,n,e[n]);return t},I=(t,e)=>se(t,ue(e));var ft=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),de=(t,e)=>{for(var n in e)j(t,n,{get:e[n],enumerable:!0})},lt=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of fe(e))!ut.call(t,o)&&o!==n&&j(t,o,{get:()=>e[o],enumerable:!(r=ce(e,o))||r.enumerable});return t};var B=(t,e,n)=>(n=t!=null?ae(le(t)):{},lt(e||!t||!t.__esModule?j(n,"default",{value:t,enumerable:!0}):n,t)),he=t=>lt(j({},"__esModule",{value:!0}),t);var zt=ft((O,A)=>{var ye=200,At="__lodash_hash_undefined__",Tt=9007199254740991,Z="[object Arguments]",ge="[object Array]",St="[object Boolean]",Ct="[object Date]",_e="[object Error]",Q="[object Function]",jt="[object GeneratorFunction]",U="[object Map]",It="[object Number]",z="[object Object]",pt="[object Promise]",Ot="[object RegExp]",k="[object Set]",Et="[object String]",Vt="[object Symbol]",L="[object WeakMap]",Pt="[object ArrayBuffer]",M="[object DataView]",$t="[object Float32Array]",Ut="[object Float64Array]",kt="[object Int8Array]",Mt="[object Int16Array]",Nt="[object Int32Array]",Rt="[object Uint8Array]",Jt="[object Uint8ClampedArray]",Dt="[object Uint16Array]",Gt="[object Uint32Array]",ve=/[\\^$.*+?()[\]{}|]/g,me=/\w*$/,be=/^\[object .+?Constructor\]$/,we=/^(?:0|[1-9]\d*)$/,s={};s[Z]=s[ge]=s[Pt]=s[M]=s[St]=s[Ct]=s[$t]=s[Ut]=s[kt]=s[Mt]=s[Nt]=s[U]=s[It]=s[z]=s[Ot]=s[k]=s[Et]=s[Vt]=s[Rt]=s[Jt]=s[Dt]=s[Gt]=!0;s[_e]=s[Q]=s[L]=!1;var xe=typeof global=="object"&&global&&global.Object===Object&&global,Ae=typeof self=="object"&&self&&self.Object===Object&&self,h=xe||Ae||Function("return this")(),Kt=typeof O=="object"&&O&&!O.nodeType&&O,dt=Kt&&typeof A=="object"&&A&&!A.nodeType&&A,Te=dt&&dt.exports===Kt;function Se(t,e){return t.set(e[0],e[1]),t}function Ce(t,e){return t.add(e),t}function je(t,e){for(var n=-1,r=t?t.length:0;++n<r&&e(t[n],n,t)!==!1;);return t}function Ie(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t}function Bt(t,e,n,r){var o=-1,a=t?t.length:0;for(r&&a&&(n=t[++o]);++o<a;)n=e(n,t[o],o,t);return n}function Oe(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}function Ee(t,e){return t==null?void 0:t[e]}function Ht(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch(n){}return e}function ht(t){var e=-1,n=Array(t.size);return t.forEach(function(r,o){n[++e]=[o,r]}),n}function tt(t,e){return function(n){return t(e(n))}}function yt(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}var Ve=Array.prototype,Pe=Function.prototype,N=Object.prototype,H=h["__core-js_shared__"],gt=function(){var t=/[^.]+$/.exec(H&&H.keys&&H.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),Lt=Pe.toString,_=N.hasOwnProperty,R=N.toString,$e=RegExp("^"+Lt.call(_).replace(ve,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),_t=Te?h.Buffer:void 0,vt=h.Symbol,mt=h.Uint8Array,Ue=tt(Object.getPrototypeOf,Object),ke=Object.create,Me=N.propertyIsEnumerable,Ne=Ve.splice,bt=Object.getOwnPropertySymbols,Re=_t?_t.isBuffer:void 0,Je=tt(Object.keys,Object),F=C(h,"DataView"),E=C(h,"Map"),W=C(h,"Promise"),q=C(h,"Set"),X=C(h,"WeakMap"),V=C(Object,"create"),De=w(F),Ge=w(E),Ke=w(W),Be=w(q),He=w(X),wt=vt?vt.prototype:void 0,xt=wt?wt.valueOf:void 0;function b(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 Le(){this.__data__=V?V(null):{}}function Fe(t){return this.has(t)&&delete this.__data__[t]}function We(t){var e=this.__data__;if(V){var n=e[t];return n===At?void 0:n}return _.call(e,t)?e[t]:void 0}function qe(t){var e=this.__data__;return V?e[t]!==void 0:_.call(e,t)}function Xe(t,e){var n=this.__data__;return n[t]=V&&e===void 0?At:e,this}b.prototype.clear=Le;b.prototype.delete=Fe;b.prototype.get=We;b.prototype.has=qe;b.prototype.set=Xe;function y(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 Ye(){this.__data__=[]}function Ze(t){var e=this.__data__,n=J(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():Ne.call(e,n,1),!0}function Qe(t){var e=this.__data__,n=J(e,t);return n<0?void 0:e[n][1]}function ze(t){return J(this.__data__,t)>-1}function tn(t,e){var n=this.__data__,r=J(n,t);return r<0?n.push([t,e]):n[r][1]=e,this}y.prototype.clear=Ye;y.prototype.delete=Ze;y.prototype.get=Qe;y.prototype.has=ze;y.prototype.set=tn;function T(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 en(){this.__data__={hash:new b,map:new(E||y),string:new b}}function nn(t){return D(this,t).delete(t)}function rn(t){return D(this,t).get(t)}function on(t){return D(this,t).has(t)}function an(t,e){return D(this,t).set(t,e),this}T.prototype.clear=en;T.prototype.delete=nn;T.prototype.get=rn;T.prototype.has=on;T.prototype.set=an;function S(t){this.__data__=new y(t)}function sn(){this.__data__=new y}function cn(t){return this.__data__.delete(t)}function un(t){return this.__data__.get(t)}function fn(t){return this.__data__.has(t)}function ln(t,e){var n=this.__data__;if(n instanceof y){var r=n.__data__;if(!E||r.length<ye-1)return r.push([t,e]),this;n=this.__data__=new T(r)}return n.set(t,e),this}S.prototype.clear=sn;S.prototype.delete=cn;S.prototype.get=un;S.prototype.has=fn;S.prototype.set=ln;function pn(t,e){var n=nt(t)||Mn(t)?Oe(t.length,String):[],r=n.length,o=!!r;for(var a in t)(e||_.call(t,a))&&!(o&&(a=="length"||Pn(a,r)))&&n.push(a);return n}function Ft(t,e,n){var r=t[e];(!(_.call(t,e)&&Yt(r,n))||n===void 0&&!(e in t))&&(t[e]=n)}function J(t,e){for(var n=t.length;n--;)if(Yt(t[n][0],e))return n;return-1}function dn(t,e){return t&&Wt(e,rt(e),t)}function Y(t,e,n,r,o,a,i){var u;if(r&&(u=a?r(t,o,a,i):r(t)),u!==void 0)return u;if(!G(t))return t;var l=nt(t);if(l){if(u=On(t),!e)return Cn(t,u)}else{var d=m(t),f=d==Q||d==jt;if(Rn(t))return mn(t,e);if(d==z||d==Z||f&&!a){if(Ht(t))return a?t:{};if(u=En(f?{}:t),!e)return jn(t,dn(u,t))}else{if(!s[d])return a?t:{};u=Vn(t,d,Y,e)}}i||(i=new S);var c=i.get(t);if(c)return c;if(i.set(t,u),!l)var g=n?In(t):rt(t);return je(g||t,function(v,$){g&&($=v,v=t[$]),Ft(u,$,Y(v,e,n,r,$,t,i))}),u}function hn(t){return G(t)?ke(t):{}}function yn(t,e,n){var r=e(t);return nt(t)?r:Ie(r,n(t))}function gn(t){return R.call(t)}function _n(t){if(!G(t)||Un(t))return!1;var e=Qt(t)||Ht(t)?$e:be;return e.test(w(t))}function vn(t){if(!Xt(t))return Je(t);var e=[];for(var n in Object(t))_.call(t,n)&&n!="constructor"&&e.push(n);return e}function mn(t,e){if(e)return t.slice();var n=new t.constructor(t.length);return t.copy(n),n}function et(t){var e=new t.constructor(t.byteLength);return new mt(e).set(new mt(t)),e}function bn(t,e){var n=e?et(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}function wn(t,e,n){var r=e?n(ht(t),!0):ht(t);return Bt(r,Se,new t.constructor)}function xn(t){var e=new t.constructor(t.source,me.exec(t));return e.lastIndex=t.lastIndex,e}function An(t,e,n){var r=e?n(yt(t),!0):yt(t);return Bt(r,Ce,new t.constructor)}function Tn(t){return xt?Object(xt.call(t)):{}}function Sn(t,e){var n=e?et(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function Cn(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}function Wt(t,e,n,r){n||(n={});for(var o=-1,a=e.length;++o<a;){var i=e[o],u=r?r(n[i],t[i],i,n,t):void 0;Ft(n,i,u===void 0?t[i]:u)}return n}function jn(t,e){return Wt(t,qt(t),e)}function In(t){return yn(t,rt,qt)}function D(t,e){var n=t.__data__;return $n(e)?n[typeof e=="string"?"string":"hash"]:n.map}function C(t,e){var n=Ee(t,e);return _n(n)?n:void 0}var qt=bt?tt(bt,Object):Gn,m=gn;(F&&m(new F(new ArrayBuffer(1)))!=M||E&&m(new E)!=U||W&&m(W.resolve())!=pt||q&&m(new q)!=k||X&&m(new X)!=L)&&(m=function(t){var e=R.call(t),n=e==z?t.constructor:void 0,r=n?w(n):void 0;if(r)switch(r){case De:return M;case Ge:return U;case Ke:return pt;case Be:return k;case He:return L}return e});function On(t){var e=t.length,n=t.constructor(e);return e&&typeof t[0]=="string"&&_.call(t,"index")&&(n.index=t.index,n.input=t.input),n}function En(t){return typeof t.constructor=="function"&&!Xt(t)?hn(Ue(t)):{}}function Vn(t,e,n,r){var o=t.constructor;switch(e){case Pt:return et(t);case St:case Ct:return new o(+t);case M:return bn(t,r);case $t:case Ut:case kt:case Mt:case Nt:case Rt:case Jt:case Dt:case Gt:return Sn(t,r);case U:return wn(t,r,n);case It:case Et:return new o(t);case Ot:return xn(t);case k:return An(t,r,n);case Vt:return Tn(t)}}function Pn(t,e){return e=e==null?Tt:e,!!e&&(typeof t=="number"||we.test(t))&&t>-1&&t%1==0&&t<e}function $n(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function Un(t){return!!gt&&gt in t}function Xt(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||N;return t===n}function w(t){if(t!=null){try{return Lt.call(t)}catch(e){}try{return t+""}catch(e){}}return""}function kn(t){return Y(t,!0,!0)}function Yt(t,e){return t===e||t!==t&&e!==e}function Mn(t){return Nn(t)&&_.call(t,"callee")&&(!Me.call(t,"callee")||R.call(t)==Z)}var nt=Array.isArray;function Zt(t){return t!=null&&Jn(t.length)&&!Qt(t)}function Nn(t){return Dn(t)&&Zt(t)}var Rn=Re||Kn;function Qt(t){var e=G(t)?R.call(t):"";return e==Q||e==jt}function Jn(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Tt}function G(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function Dn(t){return!!t&&typeof t=="object"}function rt(t){return Zt(t)?pn(t):vn(t)}function Gn(){return[]}function Kn(){return!1}A.exports=kn});var ot=ft((ir,ne)=>{var Bn="[object Object]";function Hn(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch(n){}return e}function Ln(t,e){return function(n){return t(e(n))}}var Fn=Function.prototype,te=Object.prototype,ee=Fn.toString,Wn=te.hasOwnProperty,qn=ee.call(Object),Xn=te.toString,Yn=Ln(Object.getPrototypeOf,Object);function Zn(t){return!!t&&typeof t=="object"}function Qn(t){if(!Zn(t)||Xn.call(t)!=Bn||Hn(t))return!1;var e=Yn(t);if(e===null)return!0;var n=Wn.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&ee.call(n)==qn}ne.exports=Qn});var rr={};de(rr,{looseCompare:()=>nr,version:()=>er});var K=B(zt(),1),re=B(ot(),1);function zn(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 it=zn;function oe(t,e){let n={now:!1};function r(o,a,i,u){let l=(0,K.default)(o),d,f=x({depth:-1,path:""},i);if(f.depth+=1,Array.isArray(l))for(let c=0,g=l.length;c<g&&!u.now;c++){let v=f.path?`${f.path}.${c}`:`${c}`;l[c]!==void 0?(f.parent=(0,K.default)(l),f.parentType="array",f.parentKey=it(v),d=r(a(l[c],void 0,I(x({},f),{path:v}),u),a,I(x({},f),{path:v}),u),Number.isNaN(d)&&c<l.length?(l.splice(c,1),c-=1):l[c]=d):l.splice(c,1)}else if((0,re.default)(l))for(let c in l){if(u.now&&c!=null)break;let g=f.path?`${f.path}.${c}`:c;f.depth===0&&c!=null&&(f.topmostKey=c),f.parent=(0,K.default)(l),f.parentType="object",f.parentKey=it(g),d=r(a(c,l[c],I(x({},f),{path:g}),u),a,I(x({},f),{path:g}),u),Number.isNaN(d)?delete l[c]:l[c]=d}return l}return r(t,e,{},n)}function p(t){if(typeof t=="string")return!t.trim();if(!["object","string"].includes(typeof t)||!t)return!1;let e=!0;return t=oe(t,(n,r,o,a)=>{let i=r!==void 0?r:n;return typeof i=="string"&&i.trim()&&(e=!1,a.now=!0),i}),e}var P=B(ot(),1);var ie="4.0.2";var er=ie;function at(t,e,n){function r(i){return i!=null}let o,a;if(n===void 0){if(!r(t)||!r(e))return}else if(!r(t)||!r(e))return!1;if(n=n||!0,typeof t!=typeof e)return!!(p(t)&&p(e));if(Array.isArray(t)&&Array.isArray(e))if(e.length){for(o=0,a=e.length;o<a;o++)if(Array.isArray(e[o])||(0,P.default)(e[o])){if(n=at(t[o],e[o],n),!n)return!1}else if(e[o]!==t[o])return!!(p(e[o])&&p(t[o]))}else return!!(e.length===0&&t.length===0||p(e)&&p(t));else if((0,P.default)(t)&&(0,P.default)(e))if(Object.keys(e).length){let i=Object.keys(e);for(o=0,a=i.length;o<a;o++)if(Array.isArray(e[i[o]])||(0,P.default)(e[i[o]])||typeof e[i[o]]=="string"){if(n=at(t[i[o]],e[i[o]],n),!n)return!1}else if(e[i[o]]!==t[i[o]]&&(!p(e[i[o]])||!p(t[i[o]])))return!1}else return!!(Object.keys(e).length===0&&Object.keys(t).length===0||p(e)&&p(t));else if(typeof t=="string"&&typeof e=="string"){if(t!==e)return!!(p(e)&&p(t))}else return!!(p(e)&&p(t));return n}function nr(t,e){return at(t,e)}return he(rr);})();
11
+ /**
12
+ * @name ast-contains-only-empty-space
13
+ * @fileoverview Does AST contain only empty space?
14
+ * @version 4.0.2
15
+ * @author Roy Revelt, Codsen Ltd
16
+ * @license MIT
17
+ * {@link https://codsen.com/os/ast-contains-only-empty-space/}
18
+ */
19
+ /**
20
+ * @name ast-monkey-traverse
21
+ * @fileoverview Utility library to traverse AST
22
+ * @version 4.0.2
23
+ * @author Roy Revelt, Codsen Ltd
24
+ * @license MIT
25
+ * {@link https://codsen.com/os/ast-monkey-traverse/}
26
+ */
27
+ /**
28
+ * @name ast-monkey-util
29
+ * @fileoverview Utility library of AST helper functions
30
+ * @version 3.0.2
31
+ * @author Roy Revelt, Codsen Ltd
32
+ * @license MIT
33
+ * {@link https://codsen.com/os/ast-monkey-util/}
34
+ */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ast-loose-compare",
3
- "version": "4.0.1",
3
+ "version": "4.0.2",
4
4
  "description": "Compare anything: AST, objects, arrays and strings",
5
5
  "keywords": [
6
6
  "array",
@@ -79,7 +79,7 @@
79
79
  }
80
80
  },
81
81
  "dependencies": {
82
- "ast-contains-only-empty-space": "^4.0.1",
82
+ "ast-contains-only-empty-space": "^4.0.2",
83
83
  "lodash.isplainobject": "^4.0.6"
84
84
  },
85
85
  "devDependencies": {