ast-compare 4.0.20 → 4.0.22

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2010-2023 Roy Revelt and other contributors
3
+ Copyright (c) 2010-2024 Roy Revelt and other contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
package/README.md CHANGED
@@ -70,6 +70,6 @@ To report bugs or request features or assistance, [raise an issue](https://githu
70
70
 
71
71
  MIT License.
72
72
 
73
- Copyright © 2010-2023 Roy Revelt and other contributors.
73
+ Copyright © 2010-2024 Roy Revelt and other contributors.
74
74
 
75
75
  <p align="center"><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"></p>
@@ -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.0.20
4
+ * @version 4.0.22
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/ast-compare/}
8
8
  */
9
9
 
10
- import i from"type-detect";import{empty as s}from"ast-contains-only-empty-space";import{isPlainObject as o,hasOwnProp as O}from"codsen-utils";import{isMatch as m}from"matcher";var f="4.0.20";var x=f;function V(e){return o(e)?!Object.keys(e).length:Array.isArray(e)||typeof e=="string"?!e.length:!1}var j={hungryForWhitespace:!1,matchStrictly:!1,verboseWhenMismatches:!1,useWildcards:!1};function d(e,t,b){let c,u,h,g=0,r={...j,...b};if(r.hungryForWhitespace&&r.matchStrictly&&o(e)&&s(e)&&o(t)&&!Object.keys(t).length)return!0;if((!r.hungryForWhitespace||r.hungryForWhitespace&&!s(e)&&s(t))&&o(e)&&Object.keys(e).length!==0&&o(t)&&Object.keys(t).length===0||i(e)!==i(t)&&(!r.hungryForWhitespace||r.hungryForWhitespace&&!s(e)))return!1;if(typeof e=="string"&&typeof t=="string")return r.hungryForWhitespace&&s(e)&&s(t)?!0:r.verboseWhenMismatches?e===t?!0:`Given string ${t} is not matched! We have ${e} on the other end.`:r.useWildcards?m(e,t,{caseSensitive:!0}):e===t;if(Array.isArray(e)&&Array.isArray(t)){if(r.hungryForWhitespace&&s(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, ${JSON.stringify(t,null,4)} is ${t.length} but the length of an array on the other end, ${JSON.stringify(e,null,4)} is ${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, ${JSON.stringify(e,null,4)} does have some`:!1;for(let n=0,a=t.length;n<a;n++){h=!1;for(let l=g,y=e.length;l<y;l++)if(g+=1,d(e[l],t[n],r)===!0){h=!0;break}if(!h)return r.verboseWhenMismatches?`The given array ${JSON.stringify(t,null,4)} is not a subset of an array on the other end, ${JSON.stringify(e,null,4)}`:!1}}else if(o(e)&&o(t)){if(c=new Set(Object.keys(t)),u=new Set(Object.keys(e)),r.matchStrictly&&c.size!==u.size){if(!r.verboseWhenMismatches)return!1;let n=new Set([...c].filter(p=>!u.has(p))),a=n.size?` First object has unique keys: ${JSON.stringify(n,null,4)}.`:"",l=new Set([...u].filter(p=>!c.has(p))),y=l.size?` Second object has unique keys:
10
+ import i from"type-detect";import{empty as s}from"ast-contains-only-empty-space";import{isPlainObject as o,hasOwnProp as O}from"codsen-utils";import{isMatch as m}from"matcher";var f="4.0.22";var x=f;function V(e){return o(e)?!Object.keys(e).length:Array.isArray(e)||typeof e=="string"?!e.length:!1}var j={hungryForWhitespace:!1,matchStrictly:!1,verboseWhenMismatches:!1,useWildcards:!1};function d(e,t,b){let c,u,h,g=0,r={...j,...b};if(r.hungryForWhitespace&&r.matchStrictly&&o(e)&&s(e)&&o(t)&&!Object.keys(t).length)return!0;if((!r.hungryForWhitespace||r.hungryForWhitespace&&!s(e)&&s(t))&&o(e)&&Object.keys(e).length!==0&&o(t)&&Object.keys(t).length===0||i(e)!==i(t)&&(!r.hungryForWhitespace||r.hungryForWhitespace&&!s(e)))return!1;if(typeof e=="string"&&typeof t=="string")return r.hungryForWhitespace&&s(e)&&s(t)?!0:r.verboseWhenMismatches?e===t?!0:`Given string ${t} is not matched! We have ${e} on the other end.`:r.useWildcards?m(e,t,{caseSensitive:!0}):e===t;if(Array.isArray(e)&&Array.isArray(t)){if(r.hungryForWhitespace&&s(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, ${JSON.stringify(t,null,4)} is ${t.length} but the length of an array on the other end, ${JSON.stringify(e,null,4)} is ${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, ${JSON.stringify(e,null,4)} does have some`:!1;for(let n=0,a=t.length;n<a;n++){h=!1;for(let l=g,y=e.length;l<y;l++)if(g+=1,d(e[l],t[n],r)===!0){h=!0;break}if(!h)return r.verboseWhenMismatches?`The given array ${JSON.stringify(t,null,4)} is not a subset of an array on the other end, ${JSON.stringify(e,null,4)}`:!1}}else if(o(e)&&o(t)){if(c=new Set(Object.keys(t)),u=new Set(Object.keys(e)),r.matchStrictly&&c.size!==u.size){if(!r.verboseWhenMismatches)return!1;let n=new Set([...c].filter(p=>!u.has(p))),a=n.size?` First object has unique keys: ${JSON.stringify(n,null,4)}.`:"",l=new Set([...u].filter(p=>!c.has(p))),y=l.size?` Second object has unique keys:
11
11
  ${JSON.stringify(l,null,4)}.`:"";return`When matching strictly, we found that both objects have different amount of keys.${a}${y}`}for(let n of c){if(!O(e,n))return!r.useWildcards||r.useWildcards&&!n.includes("*")?r.verboseWhenMismatches?`The given object has key "${n}" which the other-one does not have.`:!1:Object.keys(e).some(a=>m(a,n,{caseSensitive:!0}))?!0:r.verboseWhenMismatches?`The given object has key "${n}" which the other-one does not have.`:!1;if(e[n]!=null&&i(e[n])!==i(t[n])){if(!(s(e[n])&&s(t[n])&&r.hungryForWhitespace))return r.verboseWhenMismatches?`The given key ${n} is of a different type on both objects. On the first-one, it's ${i(t[n])}, on the second-one, it's ${i(e[n])}`:!1}else if(d(e[n],t[n],r)!==!0)return r.verboseWhenMismatches?`The given piece ${JSON.stringify(t[n],null,4)} and ${JSON.stringify(e[n],null,4)} don't match.`:!1}}else return r.hungryForWhitespace&&s(e)&&s(t)&&(!r.matchStrictly||r.matchStrictly&&V(t))?!0:e===t;return!0}export{d as compare,j as defaults,x as version};
@@ -1,18 +1,18 @@
1
1
  /**
2
2
  * @name ast-compare
3
3
  * @fileoverview Compare anything: AST, objects, arrays, strings and nested thereof
4
- * @version 4.0.20
4
+ * @version 4.0.22
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/ast-compare/}
8
8
  */
9
9
 
10
- "use strict";var astCompare=(()=>{var re=Object.create;var A=Object.defineProperty,ne=Object.defineProperties,se=Object.getOwnPropertyDescriptor,oe=Object.getOwnPropertyDescriptors,ie=Object.getOwnPropertyNames,B=Object.getOwnPropertySymbols,ae=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty,le=Object.prototype.propertyIsEnumerable;var J=(e,t,a)=>t in e?A(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,m=(e,t)=>{for(var a in t||(t={}))F.call(t,a)&&J(e,a,t[a]);if(B)for(var a of B(t))le.call(t,a)&&J(e,a,t[a]);return e},S=(e,t)=>ne(e,oe(t));var I=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),fe=(e,t)=>{for(var a in t)A(e,a,{get:t[a],enumerable:!0})},K=(e,t,a,f)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ie(t))!F.call(e,o)&&o!==a&&A(e,o,{get:()=>t[o],enumerable:!(f=se(t,o))||f.enumerable});return e};var O=(e,t,a)=>(a=e!=null?re(ae(e)):{},K(t||!e||!e.__esModule?A(a,"default",{value:e,enumerable:!0}):a,e)),ue=e=>K(A({},"__esModule",{value:!0}),e);var R=I(($,D)=>{(function(e,t){typeof $=="object"&&typeof D<"u"?D.exports=t():typeof define=="function"&&define.amd?define(t):e.typeDetect=t()})($,function(){"use strict";var e=typeof Promise=="function",t=typeof self=="object"?self:global,a=typeof Symbol<"u",f=typeof Map<"u",o=typeof Set<"u",u=typeof WeakMap<"u",s=typeof WeakSet<"u",r=typeof DataView<"u",n=a&&typeof Symbol.iterator<"u",i=a&&typeof Symbol.toStringTag<"u",l=o&&typeof Set.prototype.entries=="function",c=f&&typeof Map.prototype.entries=="function",p=l&&Object.getPrototypeOf(new Set().entries()),b=c&&Object.getPrototypeOf(new Map().entries()),N=n&&typeof Array.prototype[Symbol.iterator]=="function",_=N&&Object.getPrototypeOf([][Symbol.iterator]()),C=n&&typeof String.prototype[Symbol.iterator]=="function",X=C&&Object.getPrototypeOf(""[Symbol.iterator]()),Y=8,ee=-1;function te(y){var P=typeof y;if(P!=="object")return P;if(y===null)return"null";if(y===t)return"global";if(Array.isArray(y)&&(i===!1||!(Symbol.toStringTag in y)))return"Array";if(typeof window=="object"&&window!==null){if(typeof window.location=="object"&&y===window.location)return"Location";if(typeof window.document=="object"&&y===window.document)return"Document";if(typeof window.navigator=="object"){if(typeof window.navigator.mimeTypes=="object"&&y===window.navigator.mimeTypes)return"MimeTypeArray";if(typeof window.navigator.plugins=="object"&&y===window.navigator.plugins)return"PluginArray"}if((typeof window.HTMLElement=="function"||typeof window.HTMLElement=="object")&&y instanceof window.HTMLElement){if(y.tagName==="BLOCKQUOTE")return"HTMLQuoteElement";if(y.tagName==="TD")return"HTMLTableDataCellElement";if(y.tagName==="TH")return"HTMLTableHeaderCellElement"}}var L=i&&y[Symbol.toStringTag];if(typeof L=="string")return L;var g=Object.getPrototypeOf(y);return g===RegExp.prototype?"RegExp":g===Date.prototype?"Date":e&&g===Promise.prototype?"Promise":o&&g===Set.prototype?"Set":f&&g===Map.prototype?"Map":s&&g===WeakSet.prototype?"WeakSet":u&&g===WeakMap.prototype?"WeakMap":r&&g===DataView.prototype?"DataView":f&&g===b?"Map Iterator":o&&g===p?"Set Iterator":N&&g===_?"Array Iterator":C&&g===X?"String Iterator":g===null?"Object":Object.prototype.toString.call(y).slice(Y,ee)}return te})});var E=I((Se,k)=>{"use strict";k.exports=ce;function w(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}function ce(e){if(e=e||{},e.circles)return pe(e);return e.proto?f:a;function t(o,u){for(var s=Object.keys(o),r=new Array(s.length),n=0;n<s.length;n++){var i=s[n],l=o[i];typeof l!="object"||l===null?r[i]=l:l instanceof Date?r[i]=new Date(l):ArrayBuffer.isView(l)?r[i]=w(l):r[i]=u(l)}return r}function a(o){if(typeof o!="object"||o===null)return o;if(o instanceof Date)return new Date(o);if(Array.isArray(o))return t(o,a);if(o instanceof Map)return new Map(t(Array.from(o),a));if(o instanceof Set)return new Set(t(Array.from(o),a));var u={};for(var s in o)if(Object.hasOwnProperty.call(o,s)!==!1){var r=o[s];typeof r!="object"||r===null?u[s]=r:r instanceof Date?u[s]=new Date(r):r instanceof Map?u[s]=new Map(t(Array.from(r),a)):r instanceof Set?u[s]=new Set(t(Array.from(r),a)):ArrayBuffer.isView(r)?u[s]=w(r):u[s]=a(r)}return u}function f(o){if(typeof o!="object"||o===null)return o;if(o instanceof Date)return new Date(o);if(Array.isArray(o))return t(o,f);if(o instanceof Map)return new Map(t(Array.from(o),f));if(o instanceof Set)return new Set(t(Array.from(o),f));var u={};for(var s in o){var r=o[s];typeof r!="object"||r===null?u[s]=r:r instanceof Date?u[s]=new Date(r):r instanceof Map?u[s]=new Map(t(Array.from(r),f)):r instanceof Set?u[s]=new Set(t(Array.from(r),f)):ArrayBuffer.isView(r)?u[s]=w(r):u[s]=f(r)}return u}}function pe(e){var t=[],a=[];return e.proto?u:o;function f(s,r){for(var n=Object.keys(s),i=new Array(n.length),l=0;l<n.length;l++){var c=n[l],p=s[c];if(typeof p!="object"||p===null)i[c]=p;else if(p instanceof Date)i[c]=new Date(p);else if(ArrayBuffer.isView(p))i[c]=w(p);else{var b=t.indexOf(p);b!==-1?i[c]=a[b]:i[c]=r(p)}}return i}function o(s){if(typeof s!="object"||s===null)return s;if(s instanceof Date)return new Date(s);if(Array.isArray(s))return f(s,o);if(s instanceof Map)return new Map(f(Array.from(s),o));if(s instanceof Set)return new Set(f(Array.from(s),o));var r={};t.push(s),a.push(r);for(var n in s)if(Object.hasOwnProperty.call(s,n)!==!1){var i=s[n];if(typeof i!="object"||i===null)r[n]=i;else if(i instanceof Date)r[n]=new Date(i);else if(i instanceof Map)r[n]=new Map(f(Array.from(i),o));else if(i instanceof Set)r[n]=new Set(f(Array.from(i),o));else if(ArrayBuffer.isView(i))r[n]=w(i);else{var l=t.indexOf(i);l!==-1?r[n]=a[l]:r[n]=o(i)}}return t.pop(),a.pop(),r}function u(s){if(typeof s!="object"||s===null)return s;if(s instanceof Date)return new Date(s);if(Array.isArray(s))return f(s,u);if(s instanceof Map)return new Map(f(Array.from(s),u));if(s instanceof Set)return new Set(f(Array.from(s),u));var r={};t.push(s),a.push(r);for(var n in s){var i=s[n];if(typeof i!="object"||i===null)r[n]=i;else if(i instanceof Date)r[n]=new Date(i);else if(i instanceof Map)r[n]=new Map(f(Array.from(i),u));else if(i instanceof Set)r[n]=new Set(f(Array.from(i),u));else if(ArrayBuffer.isView(i))r[n]=w(i);else{var l=t.indexOf(i);l!==-1?r[n]=a[l]:r[n]=u(i)}}return t.pop(),a.pop(),r}}});var we={};fe(we,{compare:()=>W,defaults:()=>Z,version:()=>be});var v=O(R(),1);var q=O(E(),1);var H=O(E(),1);var Oe=(0,H.default)();function d(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 ye(e){return typeof e=="string"}function Q(e,t){return d(e)&&ye(t)&&t in e}function ge(e){if(e.includes(".")){let t=e.lastIndexOf(".");if(!e.slice(0,t).includes("."))return e.slice(0,t);for(let a=t-1;a--;)if(e[a]===".")return e.slice(a+1,t)}return null}var j=ge;var x=(0,q.default)();function U(e,t){let a={now:!1};function f(o,u,s,r){let n=x(o),i,l=m({depth:-1,path:""},s);if(l.depth+=1,Array.isArray(n))for(let c=0,p=n.length;c<p&&!r.now;c++){let b=l.path?`${l.path}.${c}`:`${c}`;n[c]!==void 0?(l.parent=x(n),l.parentType="array",l.parentKey=j(b),i=f(u(n[c],void 0,S(m({},l),{path:b}),r),u,S(m({},l),{path:b}),r),Number.isNaN(i)&&c<n.length?(n.splice(c,1),c-=1):n[c]=i):n.splice(c,1)}else if(d(n))for(let c in n){if(r.now&&c!=null)break;let p=l.path?`${l.path}.${c}`:c;l.depth===0&&c!=null&&(l.topmostKey=c),l.parent=x(n),l.parentType="object",l.parentKey=j(p),i=f(u(c,n[c],S(m({},l),{path:p}),r),u,S(m({},l),{path:p}),r),Number.isNaN(i)?delete n[c]:n[c]=i}return n}return f(e,t,{},a)}function h(e){if(typeof e=="string")return!e.trim();if(!["object","string"].includes(typeof e)||!e)return!1;let t=!0;return e=U(e,(a,f,o,u)=>{let s=f!==void 0?f:a;return typeof s=="string"&&s.trim()&&(t=!1,u.now=!0),s}),t}function V(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var M=new Map,z=(e,t)=>{if(!Array.isArray(e))switch(typeof e){case"string":e=[e];break;case"undefined":e=[];break;default:throw new TypeError(`Expected '${t}' to be a string or an array, but got a type of '${typeof e}'`)}return e.filter(a=>{if(typeof a!="string"){if(typeof a>"u")return!1;throw new TypeError(`Expected '${t}' to be an array of strings, but found a type of '${typeof a}' in the array`)}return!0})},he=(e,t)=>{t=m({caseSensitive:!1},t);let a=e+JSON.stringify(t);if(M.has(a))return M.get(a);let f=e[0]==="!";f&&(e=e.slice(1)),e=V(e).replace(/\\\*/g,"[\\s\\S]*");let o=new RegExp(`^${e}$`,t.caseSensitive?"":"i");return o.negated=f,M.set(a,o),o},me=(e,t,a,f)=>{if(e=z(e,"inputs"),t=z(t,"patterns"),t.length===0)return[];t=t.map(s=>he(s,a));let{allPatterns:o}=a||{},u=[];for(let s of e){let r,n=[...t].fill(!1);for(let[i,l]of t.entries())if(l.test(s)&&(n[i]=!0,r=!l.negated,!r))break;if(!(r===!1||r===void 0&&t.some(i=>!i.negated)||o&&n.some((i,l)=>!i&&!t[l].negated))&&(u.push(s),f))break}return u};function T(e,t,a){return me(e,t,a,!0).length>0}var G="4.0.20";var be=G;function ve(e){return d(e)?!Object.keys(e).length:Array.isArray(e)||typeof e=="string"?!e.length:!1}var Z={hungryForWhitespace:!1,matchStrictly:!1,verboseWhenMismatches:!1,useWildcards:!1};function W(e,t,a){let f,o,u,s=0,r=m(m({},Z),a);if(r.hungryForWhitespace&&r.matchStrictly&&d(e)&&h(e)&&d(t)&&!Object.keys(t).length)return!0;if((!r.hungryForWhitespace||r.hungryForWhitespace&&!h(e)&&h(t))&&d(e)&&Object.keys(e).length!==0&&d(t)&&Object.keys(t).length===0||(0,v.default)(e)!==(0,v.default)(t)&&(!r.hungryForWhitespace||r.hungryForWhitespace&&!h(e)))return!1;if(typeof e=="string"&&typeof t=="string")return r.hungryForWhitespace&&h(e)&&h(t)?!0:r.verboseWhenMismatches?e===t?!0:`Given string ${t} is not matched! We have ${e} on the other end.`:r.useWildcards?T(e,t,{caseSensitive:!0}):e===t;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, ${JSON.stringify(t,null,4)} is ${t.length} but the length of an array on the other end, ${JSON.stringify(e,null,4)} is ${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, ${JSON.stringify(e,null,4)} does have some`:!1;for(let n=0,i=t.length;n<i;n++){u=!1;for(let l=s,c=e.length;l<c;l++)if(s+=1,W(e[l],t[n],r)===!0){u=!0;break}if(!u)return r.verboseWhenMismatches?`The given array ${JSON.stringify(t,null,4)} is not a subset of an array on the other end, ${JSON.stringify(e,null,4)}`:!1}}else if(d(e)&&d(t)){if(f=new Set(Object.keys(t)),o=new Set(Object.keys(e)),r.matchStrictly&&f.size!==o.size){if(!r.verboseWhenMismatches)return!1;let n=new Set([...f].filter(p=>!o.has(p))),i=n.size?` First object has unique keys: ${JSON.stringify(n,null,4)}.`:"",l=new Set([...o].filter(p=>!f.has(p))),c=l.size?` Second object has unique keys:
10
+ "use strict";var astCompare=(()=>{var re=Object.create;var A=Object.defineProperty,ne=Object.defineProperties,se=Object.getOwnPropertyDescriptor,oe=Object.getOwnPropertyDescriptors,ie=Object.getOwnPropertyNames,B=Object.getOwnPropertySymbols,ae=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty,le=Object.prototype.propertyIsEnumerable;var J=(e,t,a)=>t in e?A(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,m=(e,t)=>{for(var a in t||(t={}))F.call(t,a)&&J(e,a,t[a]);if(B)for(var a of B(t))le.call(t,a)&&J(e,a,t[a]);return e},S=(e,t)=>ne(e,oe(t));var I=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),fe=(e,t)=>{for(var a in t)A(e,a,{get:t[a],enumerable:!0})},K=(e,t,a,f)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ie(t))!F.call(e,o)&&o!==a&&A(e,o,{get:()=>t[o],enumerable:!(f=se(t,o))||f.enumerable});return e};var O=(e,t,a)=>(a=e!=null?re(ae(e)):{},K(t||!e||!e.__esModule?A(a,"default",{value:e,enumerable:!0}):a,e)),ue=e=>K(A({},"__esModule",{value:!0}),e);var R=I(($,D)=>{(function(e,t){typeof $=="object"&&typeof D<"u"?D.exports=t():typeof define=="function"&&define.amd?define(t):e.typeDetect=t()})($,function(){"use strict";var e=typeof Promise=="function",t=typeof self=="object"?self:global,a=typeof Symbol<"u",f=typeof Map<"u",o=typeof Set<"u",u=typeof WeakMap<"u",s=typeof WeakSet<"u",r=typeof DataView<"u",n=a&&typeof Symbol.iterator<"u",i=a&&typeof Symbol.toStringTag<"u",l=o&&typeof Set.prototype.entries=="function",c=f&&typeof Map.prototype.entries=="function",p=l&&Object.getPrototypeOf(new Set().entries()),b=c&&Object.getPrototypeOf(new Map().entries()),N=n&&typeof Array.prototype[Symbol.iterator]=="function",_=N&&Object.getPrototypeOf([][Symbol.iterator]()),C=n&&typeof String.prototype[Symbol.iterator]=="function",X=C&&Object.getPrototypeOf(""[Symbol.iterator]()),Y=8,ee=-1;function te(y){var P=typeof y;if(P!=="object")return P;if(y===null)return"null";if(y===t)return"global";if(Array.isArray(y)&&(i===!1||!(Symbol.toStringTag in y)))return"Array";if(typeof window=="object"&&window!==null){if(typeof window.location=="object"&&y===window.location)return"Location";if(typeof window.document=="object"&&y===window.document)return"Document";if(typeof window.navigator=="object"){if(typeof window.navigator.mimeTypes=="object"&&y===window.navigator.mimeTypes)return"MimeTypeArray";if(typeof window.navigator.plugins=="object"&&y===window.navigator.plugins)return"PluginArray"}if((typeof window.HTMLElement=="function"||typeof window.HTMLElement=="object")&&y instanceof window.HTMLElement){if(y.tagName==="BLOCKQUOTE")return"HTMLQuoteElement";if(y.tagName==="TD")return"HTMLTableDataCellElement";if(y.tagName==="TH")return"HTMLTableHeaderCellElement"}}var L=i&&y[Symbol.toStringTag];if(typeof L=="string")return L;var g=Object.getPrototypeOf(y);return g===RegExp.prototype?"RegExp":g===Date.prototype?"Date":e&&g===Promise.prototype?"Promise":o&&g===Set.prototype?"Set":f&&g===Map.prototype?"Map":s&&g===WeakSet.prototype?"WeakSet":u&&g===WeakMap.prototype?"WeakMap":r&&g===DataView.prototype?"DataView":f&&g===b?"Map Iterator":o&&g===p?"Set Iterator":N&&g===_?"Array Iterator":C&&g===X?"String Iterator":g===null?"Object":Object.prototype.toString.call(y).slice(Y,ee)}return te})});var E=I((Se,k)=>{"use strict";k.exports=ce;function w(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}function ce(e){if(e=e||{},e.circles)return pe(e);return e.proto?f:a;function t(o,u){for(var s=Object.keys(o),r=new Array(s.length),n=0;n<s.length;n++){var i=s[n],l=o[i];typeof l!="object"||l===null?r[i]=l:l instanceof Date?r[i]=new Date(l):ArrayBuffer.isView(l)?r[i]=w(l):r[i]=u(l)}return r}function a(o){if(typeof o!="object"||o===null)return o;if(o instanceof Date)return new Date(o);if(Array.isArray(o))return t(o,a);if(o instanceof Map)return new Map(t(Array.from(o),a));if(o instanceof Set)return new Set(t(Array.from(o),a));var u={};for(var s in o)if(Object.hasOwnProperty.call(o,s)!==!1){var r=o[s];typeof r!="object"||r===null?u[s]=r:r instanceof Date?u[s]=new Date(r):r instanceof Map?u[s]=new Map(t(Array.from(r),a)):r instanceof Set?u[s]=new Set(t(Array.from(r),a)):ArrayBuffer.isView(r)?u[s]=w(r):u[s]=a(r)}return u}function f(o){if(typeof o!="object"||o===null)return o;if(o instanceof Date)return new Date(o);if(Array.isArray(o))return t(o,f);if(o instanceof Map)return new Map(t(Array.from(o),f));if(o instanceof Set)return new Set(t(Array.from(o),f));var u={};for(var s in o){var r=o[s];typeof r!="object"||r===null?u[s]=r:r instanceof Date?u[s]=new Date(r):r instanceof Map?u[s]=new Map(t(Array.from(r),f)):r instanceof Set?u[s]=new Set(t(Array.from(r),f)):ArrayBuffer.isView(r)?u[s]=w(r):u[s]=f(r)}return u}}function pe(e){var t=[],a=[];return e.proto?u:o;function f(s,r){for(var n=Object.keys(s),i=new Array(n.length),l=0;l<n.length;l++){var c=n[l],p=s[c];if(typeof p!="object"||p===null)i[c]=p;else if(p instanceof Date)i[c]=new Date(p);else if(ArrayBuffer.isView(p))i[c]=w(p);else{var b=t.indexOf(p);b!==-1?i[c]=a[b]:i[c]=r(p)}}return i}function o(s){if(typeof s!="object"||s===null)return s;if(s instanceof Date)return new Date(s);if(Array.isArray(s))return f(s,o);if(s instanceof Map)return new Map(f(Array.from(s),o));if(s instanceof Set)return new Set(f(Array.from(s),o));var r={};t.push(s),a.push(r);for(var n in s)if(Object.hasOwnProperty.call(s,n)!==!1){var i=s[n];if(typeof i!="object"||i===null)r[n]=i;else if(i instanceof Date)r[n]=new Date(i);else if(i instanceof Map)r[n]=new Map(f(Array.from(i),o));else if(i instanceof Set)r[n]=new Set(f(Array.from(i),o));else if(ArrayBuffer.isView(i))r[n]=w(i);else{var l=t.indexOf(i);l!==-1?r[n]=a[l]:r[n]=o(i)}}return t.pop(),a.pop(),r}function u(s){if(typeof s!="object"||s===null)return s;if(s instanceof Date)return new Date(s);if(Array.isArray(s))return f(s,u);if(s instanceof Map)return new Map(f(Array.from(s),u));if(s instanceof Set)return new Set(f(Array.from(s),u));var r={};t.push(s),a.push(r);for(var n in s){var i=s[n];if(typeof i!="object"||i===null)r[n]=i;else if(i instanceof Date)r[n]=new Date(i);else if(i instanceof Map)r[n]=new Map(f(Array.from(i),u));else if(i instanceof Set)r[n]=new Set(f(Array.from(i),u));else if(ArrayBuffer.isView(i))r[n]=w(i);else{var l=t.indexOf(i);l!==-1?r[n]=a[l]:r[n]=u(i)}}return t.pop(),a.pop(),r}}});var we={};fe(we,{compare:()=>W,defaults:()=>Z,version:()=>be});var v=O(R(),1);var q=O(E(),1);var H=O(E(),1);var Oe=(0,H.default)();function d(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 ye(e){return typeof e=="string"}function Q(e,t){return d(e)&&ye(t)&&t in e}function ge(e){if(e.includes(".")){let t=e.lastIndexOf(".");if(!e.slice(0,t).includes("."))return e.slice(0,t);for(let a=t-1;a--;)if(e[a]===".")return e.slice(a+1,t)}return null}var j=ge;var x=(0,q.default)();function U(e,t){let a={now:!1};function f(o,u,s,r){let n=x(o),i,l=m({depth:-1,path:""},s);if(l.depth+=1,Array.isArray(n))for(let c=0,p=n.length;c<p&&!r.now;c++){let b=l.path?`${l.path}.${c}`:`${c}`;n[c]!==void 0?(l.parent=x(n),l.parentType="array",l.parentKey=j(b),i=f(u(n[c],void 0,S(m({},l),{path:b}),r),u,S(m({},l),{path:b}),r),Number.isNaN(i)&&c<n.length?(n.splice(c,1),c-=1):n[c]=i):n.splice(c,1)}else if(d(n))for(let c in n){if(r.now&&c!=null)break;let p=l.path?`${l.path}.${c}`:c;l.depth===0&&c!=null&&(l.topmostKey=c),l.parent=x(n),l.parentType="object",l.parentKey=j(p),i=f(u(c,n[c],S(m({},l),{path:p}),r),u,S(m({},l),{path:p}),r),Number.isNaN(i)?delete n[c]:n[c]=i}return n}return f(e,t,{},a)}function h(e){if(typeof e=="string")return!e.trim();if(!["object","string"].includes(typeof e)||!e)return!1;let t=!0;return e=U(e,(a,f,o,u)=>{let s=f!==void 0?f:a;return typeof s=="string"&&s.trim()&&(t=!1,u.now=!0),s}),t}function V(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var M=new Map,z=(e,t)=>{if(!Array.isArray(e))switch(typeof e){case"string":e=[e];break;case"undefined":e=[];break;default:throw new TypeError(`Expected '${t}' to be a string or an array, but got a type of '${typeof e}'`)}return e.filter(a=>{if(typeof a!="string"){if(typeof a>"u")return!1;throw new TypeError(`Expected '${t}' to be an array of strings, but found a type of '${typeof a}' in the array`)}return!0})},he=(e,t)=>{t=m({caseSensitive:!1},t);let a=e+JSON.stringify(t);if(M.has(a))return M.get(a);let f=e[0]==="!";f&&(e=e.slice(1)),e=V(e).replace(/\\\*/g,"[\\s\\S]*");let o=new RegExp(`^${e}$`,t.caseSensitive?"":"i");return o.negated=f,M.set(a,o),o},me=(e,t,a,f)=>{if(e=z(e,"inputs"),t=z(t,"patterns"),t.length===0)return[];t=t.map(s=>he(s,a));let{allPatterns:o}=a||{},u=[];for(let s of e){let r,n=[...t].fill(!1);for(let[i,l]of t.entries())if(l.test(s)&&(n[i]=!0,r=!l.negated,!r))break;if(!(r===!1||r===void 0&&t.some(i=>!i.negated)||o&&n.some((i,l)=>!i&&!t[l].negated))&&(u.push(s),f))break}return u};function T(e,t,a){return me(e,t,a,!0).length>0}var G="4.0.22";var be=G;function ve(e){return d(e)?!Object.keys(e).length:Array.isArray(e)||typeof e=="string"?!e.length:!1}var Z={hungryForWhitespace:!1,matchStrictly:!1,verboseWhenMismatches:!1,useWildcards:!1};function W(e,t,a){let f,o,u,s=0,r=m(m({},Z),a);if(r.hungryForWhitespace&&r.matchStrictly&&d(e)&&h(e)&&d(t)&&!Object.keys(t).length)return!0;if((!r.hungryForWhitespace||r.hungryForWhitespace&&!h(e)&&h(t))&&d(e)&&Object.keys(e).length!==0&&d(t)&&Object.keys(t).length===0||(0,v.default)(e)!==(0,v.default)(t)&&(!r.hungryForWhitespace||r.hungryForWhitespace&&!h(e)))return!1;if(typeof e=="string"&&typeof t=="string")return r.hungryForWhitespace&&h(e)&&h(t)?!0:r.verboseWhenMismatches?e===t?!0:`Given string ${t} is not matched! We have ${e} on the other end.`:r.useWildcards?T(e,t,{caseSensitive:!0}):e===t;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, ${JSON.stringify(t,null,4)} is ${t.length} but the length of an array on the other end, ${JSON.stringify(e,null,4)} is ${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, ${JSON.stringify(e,null,4)} does have some`:!1;for(let n=0,i=t.length;n<i;n++){u=!1;for(let l=s,c=e.length;l<c;l++)if(s+=1,W(e[l],t[n],r)===!0){u=!0;break}if(!u)return r.verboseWhenMismatches?`The given array ${JSON.stringify(t,null,4)} is not a subset of an array on the other end, ${JSON.stringify(e,null,4)}`:!1}}else if(d(e)&&d(t)){if(f=new Set(Object.keys(t)),o=new Set(Object.keys(e)),r.matchStrictly&&f.size!==o.size){if(!r.verboseWhenMismatches)return!1;let n=new Set([...f].filter(p=>!o.has(p))),i=n.size?` First object has unique keys: ${JSON.stringify(n,null,4)}.`:"",l=new Set([...o].filter(p=>!f.has(p))),c=l.size?` Second object has unique keys:
11
11
  ${JSON.stringify(l,null,4)}.`:"";return`When matching strictly, we found that both objects have different amount of keys.${i}${c}`}for(let n of f){if(!Q(e,n))return!r.useWildcards||r.useWildcards&&!n.includes("*")?r.verboseWhenMismatches?`The given object has key "${n}" which the other-one does not have.`:!1:Object.keys(e).some(i=>T(i,n,{caseSensitive:!0}))?!0:r.verboseWhenMismatches?`The given object has key "${n}" which the other-one does not have.`:!1;if(e[n]!=null&&(0,v.default)(e[n])!==(0,v.default)(t[n])){if(!(h(e[n])&&h(t[n])&&r.hungryForWhitespace))return r.verboseWhenMismatches?`The given key ${n} is of a different type on both objects. On the first-one, it's ${(0,v.default)(t[n])}, on the second-one, it's ${(0,v.default)(e[n])}`:!1}else if(W(e[n],t[n],r)!==!0)return r.verboseWhenMismatches?`The given piece ${JSON.stringify(t[n],null,4)} and ${JSON.stringify(e[n],null,4)} don't match.`:!1}}else return r.hungryForWhitespace&&h(e)&&h(t)&&(!r.matchStrictly||r.matchStrictly&&ve(t))?!0:e===t;return!0}return ue(we);})();
12
12
  /**
13
13
  * @name codsen-utils
14
14
  * @fileoverview Various utility functions
15
- * @version 1.6.2
15
+ * @version 1.6.3
16
16
  * @author Roy Revelt, Codsen Ltd
17
17
  * @license MIT
18
18
  * {@link https://codsen.com/os/codsen-utils/}
@@ -20,7 +20,7 @@
20
20
  /**
21
21
  * @name ast-monkey-util
22
22
  * @fileoverview Utility library of AST helper functions
23
- * @version 3.0.7
23
+ * @version 3.0.8
24
24
  * @author Roy Revelt, Codsen Ltd
25
25
  * @license MIT
26
26
  * {@link https://codsen.com/os/ast-monkey-util/}
@@ -28,7 +28,7 @@
28
28
  /**
29
29
  * @name ast-monkey-traverse
30
30
  * @fileoverview Utility library to traverse AST
31
- * @version 4.0.13
31
+ * @version 4.0.15
32
32
  * @author Roy Revelt, Codsen Ltd
33
33
  * @license MIT
34
34
  * {@link https://codsen.com/os/ast-monkey-traverse/}
@@ -36,7 +36,7 @@
36
36
  /**
37
37
  * @name ast-contains-only-empty-space
38
38
  * @fileoverview Does AST contain only empty space?
39
- * @version 4.0.13
39
+ * @version 4.0.15
40
40
  * @author Roy Revelt, Codsen Ltd
41
41
  * @license MIT
42
42
  * {@link https://codsen.com/os/ast-contains-only-empty-space/}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ast-compare",
3
- "version": "4.0.20",
3
+ "version": "4.0.22",
4
4
  "description": "Compare anything: AST, objects, arrays, strings and nested thereof",
5
5
  "keywords": [
6
6
  "array",
@@ -77,13 +77,13 @@
77
77
  }
78
78
  },
79
79
  "dependencies": {
80
- "ast-contains-only-empty-space": "^4.0.13",
81
- "codsen-utils": "^1.6.2",
80
+ "ast-contains-only-empty-space": "^4.0.15",
81
+ "codsen-utils": "^1.6.3",
82
82
  "matcher": "^5.0.0",
83
83
  "type-detect": "^4.0.8"
84
84
  },
85
85
  "devDependencies": {
86
- "@types/type-detect": "^4.0.1",
87
- "type-fest": "^4.4.0"
86
+ "@types/type-detect": "^4.0.3",
87
+ "type-fest": "^4.9.0"
88
88
  }
89
89
  }