ast-compare 4.2.0 → 4.2.1

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.
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * @name ast-compare
3
3
  * @fileoverview Compare anything: AST, objects, arrays, strings and nested thereof
4
- * @version 4.2.0
4
+ * @version 4.2.1
5
5
  * @author Roy Revelt
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/ast-compare/}
8
8
  */
9
9
 
10
- import{empty as l}from"ast-contains-only-empty-space";import{hasOwnProp as D,isPlainObject as c,match as d}from"codsen-utils";var p="4.2.0";var x=p;function j(e){return c(e)?!Object.keys(e).length:Array.isArray(e)||typeof e=="string"?!e.length:!1}function b(e,n){return e===null||n===null?e===n:Array.isArray(e)||Array.isArray(n)?Array.isArray(e)&&Array.isArray(n):typeof e==typeof n}function $(e){return e===null?"null":Array.isArray(e)?"Array":c(e)?"Object":typeof e}var S={arrayOrder:"ordered",hungryForWhitespace:!1,matchStrictly:!1,verboseWhenMismatches:!1,useWildcards:!1};function w(e,n,t){return f(e,n,{...S,...t})}function f(e,n,t){let u,h,i,y=0;if(t.hungryForWhitespace&&t.matchStrictly&&c(e)&&l(e)&&c(n)&&!Object.keys(n).length)return!0;if((!t.hungryForWhitespace||t.hungryForWhitespace&&!l(e)&&l(n))&&c(e)&&Object.keys(e).length!==0&&c(n)&&Object.keys(n).length===0||!b(e,n)&&(!t.hungryForWhitespace||t.hungryForWhitespace&&!l(e)))return!1;if(typeof e=="string"&&typeof n=="string"){if(t.hungryForWhitespace&&l(e)&&l(n))return!0;let r=t.useWildcards?d(e,n,{caseSensitiveMatch:!0}):e===n;return t.verboseWhenMismatches?r?!0:`Given string ${n} is not matched! We have ${e} on the other end.`:r}if(Array.isArray(e)&&Array.isArray(n)){if(t.hungryForWhitespace&&l(n)&&(!t.matchStrictly||t.matchStrictly&&e.length===n.length))return!0;if(!t.hungryForWhitespace&&n.length>e.length||t.matchStrictly&&n.length!==e.length)return t.verboseWhenMismatches?`The length of a given array, ${JSON.stringify(n,null,4)} is ${n.length} but the length of an array on the other end, ${JSON.stringify(e,null,4)} is ${e.length}`:!1;if(n.length===0)return e.length===0?!0:t.verboseWhenMismatches?`The given array has no elements, but the array on the other end, ${JSON.stringify(e,null,4)} does have some`:!1;if(t.arrayOrder==="any")i=W(e,n,t);else{i=!0;for(let r=0,s=n.length;r<s;r++){i=!1;for(let o=y,a=e.length;o<a;o++)if(y+=1,f(e[o],n[r],t)===!0){i=!0;break}if(!i)break}}if(!i)return t.verboseWhenMismatches?`The given array ${JSON.stringify(n,null,4)} is not a subset of an array on the other end, ${JSON.stringify(e,null,4)}`:!1}else if(c(e)&&c(n)){if(u=Object.keys(n),h=Object.keys(e),t.matchStrictly&&u.length!==h.length){if(!t.verboseWhenMismatches)return!1;let r=new Set(u),s=new Set(h),o=u.filter(g=>!s.has(g)),a=o.length?` First object has unique keys: ${JSON.stringify(o,null,4)}.`:"",m=h.filter(g=>!r.has(g)),V=m.length?` Second object has unique keys:
10
+ import{empty as l}from"ast-contains-only-empty-space";import{hasOwnProp as D,isPlainObject as c,match as d}from"codsen-utils";var p="4.2.1";var x=p;function j(e){return c(e)?!Object.keys(e).length:Array.isArray(e)||typeof e=="string"?!e.length:!1}function b(e,n){return e===null||n===null?e===n:Array.isArray(e)||Array.isArray(n)?Array.isArray(e)&&Array.isArray(n):typeof e==typeof n}function $(e){return e===null?"null":Array.isArray(e)?"Array":c(e)?"Object":typeof e}var S={arrayOrder:"ordered",hungryForWhitespace:!1,matchStrictly:!1,verboseWhenMismatches:!1,useWildcards:!1};function w(e,n,t){return f(e,n,{...S,...t})}function f(e,n,t){let u,h,i,y=0;if(t.hungryForWhitespace&&t.matchStrictly&&c(e)&&l(e)&&c(n)&&!Object.keys(n).length)return!0;if((!t.hungryForWhitespace||t.hungryForWhitespace&&!l(e)&&l(n))&&c(e)&&Object.keys(e).length!==0&&c(n)&&Object.keys(n).length===0||!b(e,n)&&(!t.hungryForWhitespace||t.hungryForWhitespace&&!l(e)))return!1;if(typeof e=="string"&&typeof n=="string"){if(t.hungryForWhitespace&&l(e)&&l(n))return!0;let r=t.useWildcards?d(e,n,{caseSensitiveMatch:!0}):e===n;return t.verboseWhenMismatches?r?!0:`Given string ${n} is not matched! We have ${e} on the other end.`:r}if(Array.isArray(e)&&Array.isArray(n)){if(t.hungryForWhitespace&&l(n)&&(!t.matchStrictly||t.matchStrictly&&e.length===n.length))return!0;if(!t.hungryForWhitespace&&n.length>e.length||t.matchStrictly&&n.length!==e.length)return t.verboseWhenMismatches?`The length of a given array, ${JSON.stringify(n,null,4)} is ${n.length} but the length of an array on the other end, ${JSON.stringify(e,null,4)} is ${e.length}`:!1;if(n.length===0)return e.length===0?!0:t.verboseWhenMismatches?`The given array has no elements, but the array on the other end, ${JSON.stringify(e,null,4)} does have some`:!1;if(t.arrayOrder==="any")i=W(e,n,t);else{i=!0;for(let r=0,s=n.length;r<s;r++){i=!1;for(let o=y,a=e.length;o<a;o++)if(y+=1,f(e[o],n[r],t)===!0){i=!0;break}if(!i)break}}if(!i)return t.verboseWhenMismatches?`The given array ${JSON.stringify(n,null,4)} is not a subset of an array on the other end, ${JSON.stringify(e,null,4)}`:!1}else if(c(e)&&c(n)){if(u=Object.keys(n),h=Object.keys(e),t.matchStrictly&&u.length!==h.length){if(!t.verboseWhenMismatches)return!1;let r=new Set(u),s=new Set(h),o=u.filter(g=>!s.has(g)),a=o.length?` First object has unique keys: ${JSON.stringify(o,null,4)}.`:"",m=h.filter(g=>!r.has(g)),V=m.length?` Second object has unique keys:
11
11
  ${JSON.stringify(m,null,4)}.`:"";return`When matching strictly, we found that both objects have different amount of keys.${a}${V}`}for(let r of u){if(!D(e,r)){if(!t.useWildcards||t.useWildcards&&!r.includes("*"))return t.verboseWhenMismatches?`The given object has key "${r}" which the other-one does not have.`:!1;if(h.some(s=>d(s,r,{caseSensitiveMatch:!0})))continue;return t.verboseWhenMismatches?`The given object has key "${r}" which the other-one does not have.`:!1}if(e[r]!=null&&!b(e[r],n[r])){if(!(l(e[r])&&l(n[r])&&t.hungryForWhitespace))return t.verboseWhenMismatches?`The given key ${r} is of a different type on both objects. On the first-one, it's ${$(n[r])}, on the second-one, it's ${$(e[r])}`:!1}else if(f(e[r],n[r],t)!==!0)return t.verboseWhenMismatches?`The given piece ${JSON.stringify(n[r],null,4)} and ${JSON.stringify(e[r],null,4)} don't match.`:!1}}else return t.hungryForWhitespace&&l(e)&&l(n)&&(!t.matchStrictly||t.matchStrictly&&j(n))?!0:e===n;return!0}function W(e,n,t){let u=t.verboseWhenMismatches?{...t,verboseWhenMismatches:!1}:t,h=Array.from({length:n.length},(r,s)=>Array.from({length:e.length},(o,a)=>f(e[a],n[s],u)===!0)),i=new Array(e.length).fill(-1);function y(r,s){for(let o=0;o<e.length;o++){if(!h[r][o]||s[o])continue;s[o]=!0;let a=i[o];if(a===-1||y(a,s))return i[o]=r,!0}return!1}for(let r=0;r<n.length;r++)if(!y(r,new Array(e.length).fill(!1)))return!1;return!0}export{w as compare,S as defaults,x as version};
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * @name ast-compare
3
3
  * @fileoverview Compare anything: AST, objects, arrays, strings and nested thereof
4
- * @version 4.2.0
4
+ * @version 4.2.1
5
5
  * @author Roy Revelt
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/ast-compare/}
8
8
  */
9
9
 
10
- "use strict";var astCompare=(()=>{var v=Object.defineProperty,_=Object.defineProperties,Q=Object.getOwnPropertyDescriptor,H=Object.getOwnPropertyDescriptors,G=Object.getOwnPropertyNames,O=Object.getOwnPropertySymbols;var M=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable;var C=(e,t,r)=>t in e?v(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,S=(e,t)=>{for(var r in t||(t={}))M.call(t,r)&&C(e,r,t[r]);if(O)for(var r of O(t))z.call(t,r)&&C(e,r,t[r]);return e},F=(e,t)=>_(e,H(t));var Z=(e,t)=>{for(var r in t)v(e,r,{get:t[r],enumerable:!0})},Y=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of G(t))!M.call(e,s)&&s!==r&&v(e,s,{get:()=>t[s],enumerable:!(i=Q(t,s))||i.enumerable});return e};var X=e=>Y(v({},"__esModule",{value:!0}),e);var be={};Z(be,{compare:()=>de,defaults:()=>q,version:()=>ge});function ee(e){if(e==null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null?!1:!(Symbol.iterator in e)&&!(Symbol.toStringTag in e)}function E(e){if(typeof e=="string")return!e.trim();if(Array.isArray(e)){for(let t of e)if(!E(t))return!1}else if(ee(e)){for(let t of Object.keys(e))if(!E(e[t]))return!1}return!0}function h(e){return typeof e=="string"?!e.trim():typeof e!="object"||!e?!1:E(e)}var Se=new Set([..."\u060B$\u20BC\u17DB\xA5\u20A1\u20B1\xA3\u20AC\xA2\u20B9\uFDFC\u20AA\u20A9\u20AD\u20A8\u20AE\u20A6\u20BD\u20AB\u0E3F\u20A9\u20BA\u20B4","$U","$b","B/.","BZ$","Br","Bs","C$","CHF","Ft","Gs","J$","KM","K\u010D","L","MT","NT$","P","Q","R","R$","RD$","RM","Rp","S","S/.","TT$","Z$","kn","kr","lei","z\u0142","\u0192","\u0414\u0438\u043D.","\u0434\u0435\u043D","\u043B\u0432","\u062F.\u0625","Lek"]),te=Object.prototype.hasOwnProperty;function g(e){if(e==null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null?!1:!(Symbol.iterator in e)&&!(Symbol.toStringTag in e)}function re(e){return typeof e=="string"}function N(e,t){return g(e)&&re(t)&&te.call(e,t)}var ne=256,ie=1024,oe=1,se=new Map,le=new Map;function V(e){if(e>=97&&e<=122)return e-32;if(e>65535)return e;let t=String.fromCharCode(e).toUpperCase();if(t.length!==1)return e;let r=t.charCodeAt(0);return e>127&&r<128?e:r}function W(e,t,r,i,s,o){for(let l=0;l<s;l++){let n=e.charCodeAt(t+l),u=r.charCodeAt(i+l);if(o||(n>=97&&n<=122&&(n-=32),u>=97&&u<=122&&(u-=32)),n!==u)return!1}return!0}function B(e,t,r){let i=t.indexOf("\\");if(i===-1&&e===t)return!0;let s=t.indexOf("*");if(i===-1&&s===-1){if(r)return!1;for(let f=0;f<t.length;f++)if(t.charCodeAt(f)>127)return;return e.length===t.length&&W(e,0,t,0,t.length,!1)}if(i!==-1)return;let o=0,l=!1,n=-1;for(let f=0;f<t.length;f++){let m=t.charCodeAt(f);if(m>127)return;if(m===42){if(n=f,!l){if(o++,o>1)return;l=!0}}else l=!1}let u=n+1,a=t.length-u;return e.length<s+a?!1:W(e,0,t,0,s,r)&&W(e,e.length-a,t,u,a,r)}function ue(e){let t=new Uint32Array(e.length),r=0;for(let i=1;i<e.length;i++){for(;r>0&&e[i]!==e[r];)r=t[r-1];e[i]===e[r]&&r++,t[i]=r}return t}function ae(e,t){let r=[[]],i=!0,s=!1,o=!1,l=0;for(let c=0;c<e.length;){let y=e.codePointAt(c);if(y!==92){if(y===42)s=!0,o||(r.push([]),o=!0);else{let d=t?y:V(y);r[r.length-1].push(d),i&&(i=d<=127),l++,o=!1}c+=y>65535?2:1;continue}let b=c+1;for(;e.charCodeAt(b)===92;)b++;let A=b-c,p=e.codePointAt(b),$,j=!1;p===42?(j=A%2===0,$=j?A/2:(A-1)/2):p===void 0||p===10||p===13||p===8232||p===8233?$=Math.ceil(A/2):$=Math.floor(A/2);for(let d=0;d<$;d++)r[r.length-1].push(92),l++;if(j){o=!1,c=b;continue}if(p!==void 0){let d=t?p:V(p);r[r.length-1].push(d),i&&(i=d<=127),l++,b+=p>65535?2:1}o=!1,c=b}let n=s&&r[0].length===0,u=s&&r[r.length-1].length===0,a=[];for(let c of r)c.length&&a.push({values:c});let f=n?0:1,m=a.length-(u?0:1);for(let c=f;c<m;c++)a[c].values.length>oe&&(a[c].failure=ue(a[c].values));return{asciiOnly:i,endsWithWildcard:u,hasWildcard:s,minimumInputLength:l,segments:a,startsWithWildcard:n}}function I(e,t){let r=t?se:le,i=e.length<=ie;if(i){let o=r.get(e);if(o)return o}let s=ae(e,t);if(i){if(r.size>=ne){let o=r.keys().next().value;o!==void 0&&r.delete(o)}r.set(e,s)}return s}function L(e,t){if(t){let s=[];for(let o=0;o<e.length;){let l=e.codePointAt(o);s.push(l),o+=l>65535?2:1}return s}let r=new Uint32Array(e.length),i=0;for(let s=0;s<e.length;){let o=e.codePointAt(s);r[i]=V(o),i++,s+=o>65535?2:1}return i===r.length?r:r.subarray(0,i)}function D(e,t,r,i){for(let s=0;s<r.values.length;s++){let o=e.charCodeAt(t+s);if(!i&&o>=97&&o<=122&&(o-=32),o!==r.values[s])return!1}return!0}function fe(e,t,r,i,s){let o=i-t.values.length;if(o<r)return-1;if(!t.failure){for(let n=r;n<=o;n++)if(D(e,n,t,s))return n;return-1}let l=0;for(let n=r;n<i;n++){let u=e.charCodeAt(n);for(!s&&u>=97&&u<=122&&(u-=32);l>0&&u!==t.values[l];)l=t.failure[l-1];if(u===t.values[l]&&(l++,l===t.values.length))return n-l+1}return-1}function R(e,t,r){if(e.length<t.minimumInputLength)return!1;if(!t.hasWildcard)return e.length===t.minimumInputLength&&D(e,0,t.segments[0],r);let i=0,s=t.segments.length,o=0,l=e.length;if(!t.startsWithWildcard){let n=t.segments[0];if(!D(e,0,n,r))return!1;o=n.values.length,i++}if(!t.endsWithWildcard){s--;let n=t.segments[s];if(l-=n.values.length,!D(e,l,n,r))return!1}for(let n=i;n<s;n++){let u=t.segments[n],a=fe(e,u,o,l,r);if(a===-1)return!1;o=a+u.values.length}return!0}function w(e,t,r){for(let i=0;i<r.values.length;i++)if(e[t+i]!==r.values[i])return!1;return!0}function ce(e,t,r,i){let s=i-t.values.length;if(s<r)return-1;if(!t.failure){for(let l=r;l<=s;l++)if(w(e,l,t))return l;return-1}let o=0;for(let l=r;l<i;l++){for(;o>0&&e[l]!==t.values[o];)o=t.failure[o-1];if(e[l]===t.values[o]&&(o++,o===t.values.length))return l-o+1}return-1}function T(e,t){if(e.length<t.minimumInputLength)return!1;if(!t.hasWildcard)return e.length===t.minimumInputLength&&w(e,0,t.segments[0]);let r=0,i=t.segments.length,s=0,o=e.length;if(!t.startsWithWildcard){let l=t.segments[0];if(!w(e,0,l))return!1;s=l.values.length,r++}if(!t.endsWithWildcard){i--;let l=t.segments[i];if(o-=l.values.length,!w(e,o,l))return!1}for(let l=r;l<i;l++){let n=t.segments[l],u=ce(e,n,s,o);if(u===-1)return!1;s=u+n.values.length}return!0}function he(e,t,r){let i=B(e,t,r);if(i!==void 0)return i;let s=I(t,r);return s.asciiOnly?R(e,s,r):T(L(e,r),s)}function J(e,t,r,i){var l;let s=B(e,t,r);if(s!==void 0)return s;let o=I(t,r);return o.asciiOnly?R(e,o,r):((l=i.tokens)!=null||(i.tokens=L(e,r)),T(i.tokens,o))}function x(e,t,r){if(typeof t!="string"&&!t.length)return!1;let i=r===void 0?!1:r.caseSensitiveMatch===!0;if(typeof t=="string"){let n=t.charCodeAt(0)===33,u=n?t.slice(1):t,a=he(e,u,i);return n?!a:a}let s={},o=!1,l=!1;for(let n of t){let u=n.charCodeAt(0)===33,a=u?n.slice(1):n;if(u){if(J(e,a,i,s))return!1}else o=!0,!l&&J(e,a,i,s)&&(l=!0)}return o?l:!0}var P="4.2.0";var ge=P;function ye(e){return g(e)?!Object.keys(e).length:Array.isArray(e)||typeof e=="string"?!e.length:!1}function K(e,t){return e===null||t===null?e===t:Array.isArray(e)||Array.isArray(t)?Array.isArray(e)&&Array.isArray(t):typeof e==typeof t}function U(e){return e===null?"null":Array.isArray(e)?"Array":g(e)?"Object":typeof e}var q={arrayOrder:"ordered",hungryForWhitespace:!1,matchStrictly:!1,verboseWhenMismatches:!1,useWildcards:!1};function de(e,t,r){return k(e,t,S(S({},q),r))}function k(e,t,r){let i,s,o,l=0;if(r.hungryForWhitespace&&r.matchStrictly&&g(e)&&h(e)&&g(t)&&!Object.keys(t).length)return!0;if((!r.hungryForWhitespace||r.hungryForWhitespace&&!h(e)&&h(t))&&g(e)&&Object.keys(e).length!==0&&g(t)&&Object.keys(t).length===0||!K(e,t)&&(!r.hungryForWhitespace||r.hungryForWhitespace&&!h(e)))return!1;if(typeof e=="string"&&typeof t=="string"){if(r.hungryForWhitespace&&h(e)&&h(t))return!0;let n=r.useWildcards?x(e,t,{caseSensitiveMatch:!0}):e===t;return r.verboseWhenMismatches?n?!0:"Given string ".concat(t," is not matched! We have ").concat(e," on the other end."):n}if(Array.isArray(e)&&Array.isArray(t)){if(r.hungryForWhitespace&&h(t)&&(!r.matchStrictly||r.matchStrictly&&e.length===t.length))return!0;if(!r.hungryForWhitespace&&t.length>e.length||r.matchStrictly&&t.length!==e.length)return r.verboseWhenMismatches?"The length of a given array, ".concat(JSON.stringify(t,null,4)," is ").concat(t.length," but the length of an array on the other end, ").concat(JSON.stringify(e,null,4)," is ").concat(e.length):!1;if(t.length===0)return e.length===0?!0:r.verboseWhenMismatches?"The given array has no elements, but the array on the other end, ".concat(JSON.stringify(e,null,4)," does have some"):!1;if(r.arrayOrder==="any")o=me(e,t,r);else{o=!0;for(let n=0,u=t.length;n<u;n++){o=!1;for(let a=l,f=e.length;a<f;a++)if(l+=1,k(e[a],t[n],r)===!0){o=!0;break}if(!o)break}}if(!o)return r.verboseWhenMismatches?"The given array ".concat(JSON.stringify(t,null,4)," is not a subset of an array on the other end, ").concat(JSON.stringify(e,null,4)):!1}else if(g(e)&&g(t)){if(i=Object.keys(t),s=Object.keys(e),r.matchStrictly&&i.length!==s.length){if(!r.verboseWhenMismatches)return!1;let n=new Set(i),u=new Set(s),a=i.filter(y=>!u.has(y)),f=a.length?" First object has unique keys: ".concat(JSON.stringify(a,null,4),"."):"",m=s.filter(y=>!n.has(y)),c=m.length?" Second object has unique keys:\n ".concat(JSON.stringify(m,null,4),"."):"";return"When matching strictly, we found that both objects have different amount of keys.".concat(f).concat(c)}for(let n of i){if(!N(e,n)){if(!r.useWildcards||r.useWildcards&&!n.includes("*"))return r.verboseWhenMismatches?'The given object has key "'.concat(n,'" which the other-one does not have.'):!1;if(s.some(u=>x(u,n,{caseSensitiveMatch:!0})))continue;return r.verboseWhenMismatches?'The given object has key "'.concat(n,'" which the other-one does not have.'):!1}if(e[n]!=null&&!K(e[n],t[n])){if(!(h(e[n])&&h(t[n])&&r.hungryForWhitespace))return r.verboseWhenMismatches?"The given key ".concat(n," is of a different type on both objects. On the first-one, it's ").concat(U(t[n]),", on the second-one, it's ").concat(U(e[n])):!1}else if(k(e[n],t[n],r)!==!0)return r.verboseWhenMismatches?"The given piece ".concat(JSON.stringify(t[n],null,4)," and ").concat(JSON.stringify(e[n],null,4)," don't match."):!1}}else return r.hungryForWhitespace&&h(e)&&h(t)&&(!r.matchStrictly||r.matchStrictly&&ye(t))?!0:e===t;return!0}function me(e,t,r){let i=r.verboseWhenMismatches?F(S({},r),{verboseWhenMismatches:!1}):r,s=Array.from({length:t.length},(n,u)=>Array.from({length:e.length},(a,f)=>k(e[f],t[u],i)===!0)),o=new Array(e.length).fill(-1);function l(n,u){for(let a=0;a<e.length;a++){if(!s[n][a]||u[a])continue;u[a]=!0;let f=o[a];if(f===-1||l(f,u))return o[a]=n,!0}return!1}for(let n=0;n<t.length;n++)if(!l(n,new Array(e.length).fill(!1)))return!1;return!0}return X(be);})();
10
+ "use strict";var astCompare=(()=>{var v=Object.defineProperty,_=Object.defineProperties,Q=Object.getOwnPropertyDescriptor,H=Object.getOwnPropertyDescriptors,G=Object.getOwnPropertyNames,O=Object.getOwnPropertySymbols;var M=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable;var C=(e,t,r)=>t in e?v(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,S=(e,t)=>{for(var r in t||(t={}))M.call(t,r)&&C(e,r,t[r]);if(O)for(var r of O(t))z.call(t,r)&&C(e,r,t[r]);return e},F=(e,t)=>_(e,H(t));var Z=(e,t)=>{for(var r in t)v(e,r,{get:t[r],enumerable:!0})},Y=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of G(t))!M.call(e,s)&&s!==r&&v(e,s,{get:()=>t[s],enumerable:!(i=Q(t,s))||i.enumerable});return e};var X=e=>Y(v({},"__esModule",{value:!0}),e);var be={};Z(be,{compare:()=>de,defaults:()=>q,version:()=>ge});function ee(e){if(e==null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null?!1:!(Symbol.iterator in e)&&!(Symbol.toStringTag in e)}function E(e){if(typeof e=="string")return!e.trim();if(Array.isArray(e)){for(let t of e)if(!E(t))return!1}else if(ee(e)){for(let t of Object.keys(e))if(!E(e[t]))return!1}return!0}function h(e){return typeof e=="string"?!e.trim():typeof e!="object"||!e?!1:E(e)}var Se=new Set([..."\u060B$\u20BC\u17DB\xA5\u20A1\u20B1\xA3\u20AC\xA2\u20B9\uFDFC\u20AA\u20A9\u20AD\u20A8\u20AE\u20A6\u20BD\u20AB\u0E3F\u20A9\u20BA\u20B4","$U","$b","B/.","BZ$","Br","Bs","C$","CHF","Ft","Gs","J$","KM","K\u010D","L","MT","NT$","P","Q","R","R$","RD$","RM","Rp","S","S/.","TT$","Z$","kn","kr","lei","z\u0142","\u0192","\u0414\u0438\u043D.","\u0434\u0435\u043D","\u043B\u0432","\u062F.\u0625","Lek"]),te=Object.prototype.hasOwnProperty;function g(e){if(e==null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null?!1:!(Symbol.iterator in e)&&!(Symbol.toStringTag in e)}function re(e){return typeof e=="string"}function N(e,t){return g(e)&&re(t)&&te.call(e,t)}var ne=256,ie=1024,oe=1,se=new Map,le=new Map;function V(e){if(e>=97&&e<=122)return e-32;if(e>65535)return e;let t=String.fromCharCode(e).toUpperCase();if(t.length!==1)return e;let r=t.charCodeAt(0);return e>127&&r<128?e:r}function W(e,t,r,i,s,o){for(let l=0;l<s;l++){let n=e.charCodeAt(t+l),u=r.charCodeAt(i+l);if(o||(n>=97&&n<=122&&(n-=32),u>=97&&u<=122&&(u-=32)),n!==u)return!1}return!0}function B(e,t,r){let i=t.indexOf("\\");if(i===-1&&e===t)return!0;let s=t.indexOf("*");if(i===-1&&s===-1){if(r)return!1;for(let f=0;f<t.length;f++)if(t.charCodeAt(f)>127)return;return e.length===t.length&&W(e,0,t,0,t.length,!1)}if(i!==-1)return;let o=0,l=!1,n=-1;for(let f=0;f<t.length;f++){let m=t.charCodeAt(f);if(m>127)return;if(m===42){if(n=f,!l){if(o++,o>1)return;l=!0}}else l=!1}let u=n+1,a=t.length-u;return e.length<s+a?!1:W(e,0,t,0,s,r)&&W(e,e.length-a,t,u,a,r)}function ue(e){let t=new Uint32Array(e.length),r=0;for(let i=1;i<e.length;i++){for(;r>0&&e[i]!==e[r];)r=t[r-1];e[i]===e[r]&&r++,t[i]=r}return t}function ae(e,t){let r=[[]],i=!0,s=!1,o=!1,l=0;for(let c=0;c<e.length;){let y=e.codePointAt(c);if(y!==92){if(y===42)s=!0,o||(r.push([]),o=!0);else{let d=t?y:V(y);r[r.length-1].push(d),i&&(i=d<=127),l++,o=!1}c+=y>65535?2:1;continue}let b=c+1;for(;e.charCodeAt(b)===92;)b++;let A=b-c,p=e.codePointAt(b),$,j=!1;p===42?(j=A%2===0,$=j?A/2:(A-1)/2):p===void 0||p===10||p===13||p===8232||p===8233?$=Math.ceil(A/2):$=Math.floor(A/2);for(let d=0;d<$;d++)r[r.length-1].push(92),l++;if(j){o=!1,c=b;continue}if(p!==void 0){let d=t?p:V(p);r[r.length-1].push(d),i&&(i=d<=127),l++,b+=p>65535?2:1}o=!1,c=b}let n=s&&r[0].length===0,u=s&&r[r.length-1].length===0,a=[];for(let c of r)c.length&&a.push({values:c});let f=n?0:1,m=a.length-(u?0:1);for(let c=f;c<m;c++)a[c].values.length>oe&&(a[c].failure=ue(a[c].values));return{asciiOnly:i,endsWithWildcard:u,hasWildcard:s,minimumInputLength:l,segments:a,startsWithWildcard:n}}function I(e,t){let r=t?se:le,i=e.length<=ie;if(i){let o=r.get(e);if(o)return o}let s=ae(e,t);if(i){if(r.size>=ne){let o=r.keys().next().value;o!==void 0&&r.delete(o)}r.set(e,s)}return s}function L(e,t){if(t){let s=[];for(let o=0;o<e.length;){let l=e.codePointAt(o);s.push(l),o+=l>65535?2:1}return s}let r=new Uint32Array(e.length),i=0;for(let s=0;s<e.length;){let o=e.codePointAt(s);r[i]=V(o),i++,s+=o>65535?2:1}return i===r.length?r:r.subarray(0,i)}function D(e,t,r,i){for(let s=0;s<r.values.length;s++){let o=e.charCodeAt(t+s);if(!i&&o>=97&&o<=122&&(o-=32),o!==r.values[s])return!1}return!0}function fe(e,t,r,i,s){let o=i-t.values.length;if(o<r)return-1;if(!t.failure){for(let n=r;n<=o;n++)if(D(e,n,t,s))return n;return-1}let l=0;for(let n=r;n<i;n++){let u=e.charCodeAt(n);for(!s&&u>=97&&u<=122&&(u-=32);l>0&&u!==t.values[l];)l=t.failure[l-1];if(u===t.values[l]&&(l++,l===t.values.length))return n-l+1}return-1}function R(e,t,r){if(e.length<t.minimumInputLength)return!1;if(!t.hasWildcard)return e.length===t.minimumInputLength&&D(e,0,t.segments[0],r);let i=0,s=t.segments.length,o=0,l=e.length;if(!t.startsWithWildcard){let n=t.segments[0];if(!D(e,0,n,r))return!1;o=n.values.length,i++}if(!t.endsWithWildcard){s--;let n=t.segments[s];if(l-=n.values.length,!D(e,l,n,r))return!1}for(let n=i;n<s;n++){let u=t.segments[n],a=fe(e,u,o,l,r);if(a===-1)return!1;o=a+u.values.length}return!0}function w(e,t,r){for(let i=0;i<r.values.length;i++)if(e[t+i]!==r.values[i])return!1;return!0}function ce(e,t,r,i){let s=i-t.values.length;if(s<r)return-1;if(!t.failure){for(let l=r;l<=s;l++)if(w(e,l,t))return l;return-1}let o=0;for(let l=r;l<i;l++){for(;o>0&&e[l]!==t.values[o];)o=t.failure[o-1];if(e[l]===t.values[o]&&(o++,o===t.values.length))return l-o+1}return-1}function T(e,t){if(e.length<t.minimumInputLength)return!1;if(!t.hasWildcard)return e.length===t.minimumInputLength&&w(e,0,t.segments[0]);let r=0,i=t.segments.length,s=0,o=e.length;if(!t.startsWithWildcard){let l=t.segments[0];if(!w(e,0,l))return!1;s=l.values.length,r++}if(!t.endsWithWildcard){i--;let l=t.segments[i];if(o-=l.values.length,!w(e,o,l))return!1}for(let l=r;l<i;l++){let n=t.segments[l],u=ce(e,n,s,o);if(u===-1)return!1;s=u+n.values.length}return!0}function he(e,t,r){let i=B(e,t,r);if(i!==void 0)return i;let s=I(t,r);return s.asciiOnly?R(e,s,r):T(L(e,r),s)}function J(e,t,r,i){var l;let s=B(e,t,r);if(s!==void 0)return s;let o=I(t,r);return o.asciiOnly?R(e,o,r):((l=i.tokens)!=null||(i.tokens=L(e,r)),T(i.tokens,o))}function x(e,t,r){if(typeof t!="string"&&!t.length)return!1;let i=r===void 0?!1:r.caseSensitiveMatch===!0;if(typeof t=="string"){let n=t.charCodeAt(0)===33,u=n?t.slice(1):t,a=he(e,u,i);return n?!a:a}let s={},o=!1,l=!1;for(let n of t){let u=n.charCodeAt(0)===33,a=u?n.slice(1):n;if(u){if(J(e,a,i,s))return!1}else o=!0,!l&&J(e,a,i,s)&&(l=!0)}return o?l:!0}var P="4.2.1";var ge=P;function ye(e){return g(e)?!Object.keys(e).length:Array.isArray(e)||typeof e=="string"?!e.length:!1}function K(e,t){return e===null||t===null?e===t:Array.isArray(e)||Array.isArray(t)?Array.isArray(e)&&Array.isArray(t):typeof e==typeof t}function U(e){return e===null?"null":Array.isArray(e)?"Array":g(e)?"Object":typeof e}var q={arrayOrder:"ordered",hungryForWhitespace:!1,matchStrictly:!1,verboseWhenMismatches:!1,useWildcards:!1};function de(e,t,r){return k(e,t,S(S({},q),r))}function k(e,t,r){let i,s,o,l=0;if(r.hungryForWhitespace&&r.matchStrictly&&g(e)&&h(e)&&g(t)&&!Object.keys(t).length)return!0;if((!r.hungryForWhitespace||r.hungryForWhitespace&&!h(e)&&h(t))&&g(e)&&Object.keys(e).length!==0&&g(t)&&Object.keys(t).length===0||!K(e,t)&&(!r.hungryForWhitespace||r.hungryForWhitespace&&!h(e)))return!1;if(typeof e=="string"&&typeof t=="string"){if(r.hungryForWhitespace&&h(e)&&h(t))return!0;let n=r.useWildcards?x(e,t,{caseSensitiveMatch:!0}):e===t;return r.verboseWhenMismatches?n?!0:"Given string ".concat(t," is not matched! We have ").concat(e," on the other end."):n}if(Array.isArray(e)&&Array.isArray(t)){if(r.hungryForWhitespace&&h(t)&&(!r.matchStrictly||r.matchStrictly&&e.length===t.length))return!0;if(!r.hungryForWhitespace&&t.length>e.length||r.matchStrictly&&t.length!==e.length)return r.verboseWhenMismatches?"The length of a given array, ".concat(JSON.stringify(t,null,4)," is ").concat(t.length," but the length of an array on the other end, ").concat(JSON.stringify(e,null,4)," is ").concat(e.length):!1;if(t.length===0)return e.length===0?!0:r.verboseWhenMismatches?"The given array has no elements, but the array on the other end, ".concat(JSON.stringify(e,null,4)," does have some"):!1;if(r.arrayOrder==="any")o=me(e,t,r);else{o=!0;for(let n=0,u=t.length;n<u;n++){o=!1;for(let a=l,f=e.length;a<f;a++)if(l+=1,k(e[a],t[n],r)===!0){o=!0;break}if(!o)break}}if(!o)return r.verboseWhenMismatches?"The given array ".concat(JSON.stringify(t,null,4)," is not a subset of an array on the other end, ").concat(JSON.stringify(e,null,4)):!1}else if(g(e)&&g(t)){if(i=Object.keys(t),s=Object.keys(e),r.matchStrictly&&i.length!==s.length){if(!r.verboseWhenMismatches)return!1;let n=new Set(i),u=new Set(s),a=i.filter(y=>!u.has(y)),f=a.length?" First object has unique keys: ".concat(JSON.stringify(a,null,4),"."):"",m=s.filter(y=>!n.has(y)),c=m.length?" Second object has unique keys:\n ".concat(JSON.stringify(m,null,4),"."):"";return"When matching strictly, we found that both objects have different amount of keys.".concat(f).concat(c)}for(let n of i){if(!N(e,n)){if(!r.useWildcards||r.useWildcards&&!n.includes("*"))return r.verboseWhenMismatches?'The given object has key "'.concat(n,'" which the other-one does not have.'):!1;if(s.some(u=>x(u,n,{caseSensitiveMatch:!0})))continue;return r.verboseWhenMismatches?'The given object has key "'.concat(n,'" which the other-one does not have.'):!1}if(e[n]!=null&&!K(e[n],t[n])){if(!(h(e[n])&&h(t[n])&&r.hungryForWhitespace))return r.verboseWhenMismatches?"The given key ".concat(n," is of a different type on both objects. On the first-one, it's ").concat(U(t[n]),", on the second-one, it's ").concat(U(e[n])):!1}else if(k(e[n],t[n],r)!==!0)return r.verboseWhenMismatches?"The given piece ".concat(JSON.stringify(t[n],null,4)," and ").concat(JSON.stringify(e[n],null,4)," don't match."):!1}}else return r.hungryForWhitespace&&h(e)&&h(t)&&(!r.matchStrictly||r.matchStrictly&&ye(t))?!0:e===t;return!0}function me(e,t,r){let i=r.verboseWhenMismatches?F(S({},r),{verboseWhenMismatches:!1}):r,s=Array.from({length:t.length},(n,u)=>Array.from({length:e.length},(a,f)=>k(e[f],t[u],i)===!0)),o=new Array(e.length).fill(-1);function l(n,u){for(let a=0;a<e.length;a++){if(!s[n][a]||u[a])continue;u[a]=!0;let f=o[a];if(f===-1||l(f,u))return o[a]=n,!0}return!1}for(let n=0;n<t.length;n++)if(!l(n,new Array(e.length).fill(!1)))return!1;return!0}return X(be);})();
11
11
  /**
12
12
  * @name ast-contains-only-empty-space
13
13
  * @fileoverview Does AST contain only empty space?
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ast-compare",
3
- "version": "4.2.0",
3
+ "version": "4.2.1",
4
4
  "description": "Compare anything: AST, objects, arrays, strings and nested thereof",
5
5
  "keywords": [
6
6
  "array",