ast-compare 4.0.31 → 4.0.41
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/dist/ast-compare.esm.js
CHANGED
|
@@ -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.
|
|
4
|
+
* @version 4.0.41
|
|
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.
|
|
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,
|
|
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.41";var J=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
|
+
${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,J as version};
|
package/dist/ast-compare.umd.js
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name ast-compare
|
|
3
3
|
* @fileoverview Compare anything: AST, objects, arrays, strings and nested thereof
|
|
4
|
-
* @version 4.0.
|
|
4
|
+
* @version 4.0.41
|
|
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 $=Object.defineProperty,ne=Object.defineProperties,oe=Object.getOwnPropertyDescriptor,se=Object.getOwnPropertyDescriptors,ie=Object.getOwnPropertyNames,B=Object.getOwnPropertySymbols,ae=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty,le=Object.prototype.propertyIsEnumerable;var J=(e,t,s)=>t in e?$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,b=(e,t)=>{for(var s in t||(t={}))F.call(t,s)&&J(e,s,t[s]);if(B)for(var s of B(t))le.call(t,s)&&J(e,s,t[s]);return e},A=(e,t)=>ne(e,se(t));var I=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ue=(e,t)=>{for(var s in t)$(e,s,{get:t[s],enumerable:!0})},K=(e,t,s,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of ie(t))!F.call(e,u)&&u!==s&&$(e,u,{get:()=>t[u],enumerable:!(c=oe(t,u))||c.enumerable});return e};var D=(e,t,s)=>(s=e!=null?re(ae(e)):{},K(t||!e||!e.__esModule?$(s,"default",{value:e,enumerable:!0}):s,e)),ce=e=>K($({},"__esModule",{value:!0}),e);var R=I((x,V)=>{(function(e,t){typeof x=="object"&&typeof V<"u"?V.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self,e.typeDetect=t())})(x,function(){"use strict";var e=typeof Promise=="function",t=function(y){if(typeof globalThis=="object")return globalThis;Object.defineProperty(y,"typeDetectGlobalObject",{get:function(){return this},configurable:!0});var j=typeDetectGlobalObject;return delete y.typeDetectGlobalObject,j}(Object.prototype),s=typeof Symbol<"u",c=typeof Map<"u",u=typeof Set<"u",p=typeof WeakMap<"u",a=typeof WeakSet<"u",n=typeof DataView<"u",r=s&&typeof Symbol.iterator<"u",o=s&&typeof Symbol.toStringTag<"u",l=u&&typeof Set.prototype.entries=="function",i=c&&typeof Map.prototype.entries=="function",f=l&&Object.getPrototypeOf(new Set().entries()),d=i&&Object.getPrototypeOf(new Map().entries()),g=r&&typeof Array.prototype[Symbol.iterator]=="function",S=g&&Object.getPrototypeOf([][Symbol.iterator]()),L=r&&typeof String.prototype[Symbol.iterator]=="function",X=L&&Object.getPrototypeOf(""[Symbol.iterator]()),Y=8,ee=-1;function te(y){var j=typeof y;if(j!=="object")return j;if(y===null)return"null";if(y===t)return"global";if(Array.isArray(y)&&(o===!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 E=o&&y[Symbol.toStringTag];if(typeof E=="string")return E;var h=Object.getPrototypeOf(y);return h===RegExp.prototype?"RegExp":h===Date.prototype?"Date":e&&h===Promise.prototype?"Promise":u&&h===Set.prototype?"Set":c&&h===Map.prototype?"Map":a&&h===WeakSet.prototype?"WeakSet":p&&h===WeakMap.prototype?"WeakMap":n&&h===DataView.prototype?"DataView":c&&h===d?"Map Iterator":u&&h===f?"Set Iterator":g&&h===S?"Array Iterator":L&&h===X?"String Iterator":h===null?"Object":Object.prototype.toString.call(y).slice(Y,ee)}return te})});var k=I((we,H)=>{"use strict";H.exports=fe;function w(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}function fe(e){if(e=e||{},e.circles)return pe(e);let t=new Map;if(t.set(Date,a=>new Date(a)),t.set(Map,(a,n)=>new Map(c(Array.from(a),n))),t.set(Set,(a,n)=>new Set(c(Array.from(a),n))),e.constructorHandlers)for(let a of e.constructorHandlers)t.set(a[0],a[1]);let s=null;return e.proto?p:u;function c(a,n){let r=Object.keys(a),o=new Array(r.length);for(let l=0;l<r.length;l++){let i=r[l],f=a[i];typeof f!="object"||f===null?o[i]=f:f.constructor!==Object&&(s=t.get(f.constructor))?o[i]=s(f,n):ArrayBuffer.isView(f)?o[i]=w(f):o[i]=n(f)}return o}function u(a){if(typeof a!="object"||a===null)return a;if(Array.isArray(a))return c(a,u);if(a.constructor!==Object&&(s=t.get(a.constructor)))return s(a,u);let n={};for(let r in a){if(Object.hasOwnProperty.call(a,r)===!1)continue;let o=a[r];typeof o!="object"||o===null?n[r]=o:o.constructor!==Object&&(s=t.get(o.constructor))?n[r]=s(o,u):ArrayBuffer.isView(o)?n[r]=w(o):n[r]=u(o)}return n}function p(a){if(typeof a!="object"||a===null)return a;if(Array.isArray(a))return c(a,p);if(a.constructor!==Object&&(s=t.get(a.constructor)))return s(a,p);let n={};for(let r in a){let o=a[r];typeof o!="object"||o===null?n[r]=o:o.constructor!==Object&&(s=t.get(o.constructor))?n[r]=s(o,p):ArrayBuffer.isView(o)?n[r]=w(o):n[r]=p(o)}return n}}function pe(e){let t=[],s=[],c=new Map;if(c.set(Date,r=>new Date(r)),c.set(Map,(r,o)=>new Map(p(Array.from(r),o))),c.set(Set,(r,o)=>new Set(p(Array.from(r),o))),e.constructorHandlers)for(let r of e.constructorHandlers)c.set(r[0],r[1]);let u=null;return e.proto?n:a;function p(r,o){let l=Object.keys(r),i=new Array(l.length);for(let f=0;f<l.length;f++){let d=l[f],g=r[d];if(typeof g!="object"||g===null)i[d]=g;else if(g.constructor!==Object&&(u=c.get(g.constructor)))i[d]=u(g,o);else if(ArrayBuffer.isView(g))i[d]=w(g);else{let S=t.indexOf(g);S!==-1?i[d]=s[S]:i[d]=o(g)}}return i}function a(r){if(typeof r!="object"||r===null)return r;if(Array.isArray(r))return p(r,a);if(r.constructor!==Object&&(u=c.get(r.constructor)))return u(r,a);let o={};t.push(r),s.push(o);for(let l in r){if(Object.hasOwnProperty.call(r,l)===!1)continue;let i=r[l];if(typeof i!="object"||i===null)o[l]=i;else if(i.constructor!==Object&&(u=c.get(i.constructor)))o[l]=u(i,a);else if(ArrayBuffer.isView(i))o[l]=w(i);else{let f=t.indexOf(i);f!==-1?o[l]=s[f]:o[l]=a(i)}}return t.pop(),s.pop(),o}function n(r){if(typeof r!="object"||r===null)return r;if(Array.isArray(r))return p(r,n);if(r.constructor!==Object&&(u=c.get(r.constructor)))return u(r,n);let o={};t.push(r),s.push(o);for(let l in r){let i=r[l];if(typeof i!="object"||i===null)o[l]=i;else if(i.constructor!==Object&&(u=c.get(i.constructor)))o[l]=u(i,n);else if(ArrayBuffer.isView(i))o[l]=w(i);else{let f=t.indexOf(i);f!==-1?o[l]=s[f]:o[l]=n(i)}}return t.pop(),s.pop(),o}}});var Oe={};ue(Oe,{compare:()=>P,defaults:()=>_,version:()=>me});var v=D(R(),1);var U=D(k(),1);var Q=D(k(),1);var $e=(0,Q.default)();function O(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 O(e)&&ye(t)&&t in e}function M(e){if(e.includes(".")){let t=e.lastIndexOf(".");if(!e.slice(0,t).includes("."))return e.slice(0,t);for(let s=t-1;s--;)if(e[s]===".")return e.slice(s+1,t)}return null}var T=(0,U.default)();function z(e,t){let s={now:!1};function c(u,p,a,n){let r=T(u),o,l=b({depth:-1,path:""},a);if(l.depth+=1,Array.isArray(r))for(let i=0,f=r.length;i<f&&!n.now;i++){let d=l.path?`${l.path}.${i}`:`${i}`;r[i]!==void 0?(l.parent=T(r),l.parentType="array",l.parentKey=M(d),o=c(p(r[i],void 0,A(b({},l),{path:d}),n),p,A(b({},l),{path:d}),n),Number.isNaN(o)&&i<r.length?(r.splice(i,1),i-=1):r[i]=o):r.splice(i,1)}else if(O(r))for(let i in r){if(n.now&&i!=null)break;let f=l.path?`${l.path}.${i}`:i;l.depth===0&&i!=null&&(l.topmostKey=i),l.parent=T(r),l.parentType="object",l.parentKey=M(f),o=c(p(i,r[i],A(b({},l),{path:f}),n),p,A(b({},l),{path:f}),n),Number.isNaN(o)?delete r[i]:r[i]=o}return r}return c(e,t,{},s)}function m(e){if(typeof e=="string")return!e.trim();if(!["object","string"].includes(typeof e)||!e)return!1;let t=!0;return e=z(e,(s,c,u,p)=>{let a=c!==void 0?c:s;return typeof a=="string"&&a.trim()&&(t=!1,p.now=!0),a}),t}function W(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var N=new Map,G=(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(s=>{if(typeof s!="string"){if(typeof s>"u")return!1;throw new TypeError(`Expected '${t}' to be an array of strings, but found a type of '${typeof s}' in the array`)}return!0})},ge=(e,t)=>{t=b({caseSensitive:!1},t);let s=e+JSON.stringify(t);if(N.has(s))return N.get(s);let c=e[0]==="!";c&&(e=e.slice(1)),e=W(e).replace(/\\\*/g,"[\\s\\S]*");let u=new RegExp(`^${e}$`,t.caseSensitive?"":"i");return u.negated=c,N.set(s,u),u},he=(e,t,s,c)=>{if(e=G(e,"inputs"),t=G(t,"patterns"),t.length===0)return[];t=t.map(a=>ge(a,s));let{allPatterns:u}=s||{},p=[];for(let a of e){let n,r=[...t].fill(!1);for(let[o,l]of t.entries())if(l.test(a)&&(r[o]=!0,n=!l.negated,!n))break;if(!(n===!1||n===void 0&&t.some(o=>!o.negated)||u&&r.some((o,l)=>!o&&!t[l].negated))&&(p.push(a),c))break}return p};function C(e,t,s){return he(e,t,s,!0).length>0}var Z="4.0.31";var me=Z;function be(e){return O(e)?!Object.keys(e).length:Array.isArray(e)||typeof e=="string"?!e.length:!1}var _={hungryForWhitespace:!1,matchStrictly:!1,verboseWhenMismatches:!1,useWildcards:!1};function P(e,t,s){let c,u,p,a=0,n=b(b({},_),s);if(n.hungryForWhitespace&&n.matchStrictly&&O(e)&&m(e)&&O(t)&&!Object.keys(t).length)return!0;if((!n.hungryForWhitespace||n.hungryForWhitespace&&!m(e)&&m(t))&&O(e)&&Object.keys(e).length!==0&&O(t)&&Object.keys(t).length===0||(0,v.default)(e)!==(0,v.default)(t)&&(!n.hungryForWhitespace||n.hungryForWhitespace&&!m(e)))return!1;if(typeof e=="string"&&typeof t=="string")return n.hungryForWhitespace&&m(e)&&m(t)?!0:n.verboseWhenMismatches?e===t?!0:`Given string ${t} is not matched! We have ${e} on the other end.`:n.useWildcards?C(e,t,{caseSensitive:!0}):e===t;if(Array.isArray(e)&&Array.isArray(t)){if(n.hungryForWhitespace&&m(t)&&(!n.matchStrictly||n.matchStrictly&&e.length===t.length))return!0;if(!n.hungryForWhitespace&&t.length>e.length||n.matchStrictly&&t.length!==e.length)return n.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:n.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 r=0,o=t.length;r<o;r++){p=!1;for(let l=a,i=e.length;l<i;l++)if(a+=1,P(e[l],t[r],n)===!0){p=!0;break}if(!p)return n.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)),n.matchStrictly&&c.size!==u.size){if(!n.verboseWhenMismatches)return!1;let r=new Set([...c].filter(f=>!u.has(f))),o=r.size?` First object has unique keys: ${JSON.stringify(r,null,4)}.`:"",l=new Set([...u].filter(f=>!c.has(f))),i=l.size?` Second object has unique keys:
|
|
11
|
-
${JSON.stringify(l,null,4)}.`:"";return`When matching strictly, we found that both objects have different amount of keys.${o}${i}`}for(let r of c){if(!q(e,r))return!n.useWildcards||n.useWildcards&&!r.includes("*")?n.verboseWhenMismatches?`The given object has key "${r}" which the other-one does not have.`:!1:Object.keys(e).some(o=>C(o,r,{caseSensitive:!0}))?!0:n.verboseWhenMismatches?`The given object has key "${r}" which the other-one does not have.`:!1;if(e[r]!=null&&(0,v.default)(e[r])!==(0,v.default)(t[r])){if(!(m(e[r])&&m(t[r])&&n.hungryForWhitespace))return n.verboseWhenMismatches?`The given key ${r} is of a different type on both objects. On the first-one, it's ${(0,v.default)(t[r])}, on the second-one, it's ${(0,v.default)(e[r])}`:!1}else if(P(e[r],t[r],n)!==!0)return n.verboseWhenMismatches?`The given piece ${JSON.stringify(t[r],null,4)} and ${JSON.stringify(e[r],null,4)} don't match.`:!1}}else return n.hungryForWhitespace&&m(e)&&m(t)&&(!n.matchStrictly||n.matchStrictly&&be(t))?!0:e===t;return!0}return ce(Oe);})();
|
|
10
|
+
"use strict";var astCompare=(()=>{var ae=Object.create,J=Object.freeze,v=Object.defineProperty,le=Object.defineProperties,ce=Object.getOwnPropertyDescriptor,ue=Object.getOwnPropertyDescriptors,fe=Object.getOwnPropertyNames,I=Object.getOwnPropertySymbols,pe=Object.getPrototypeOf,_=Object.prototype.hasOwnProperty,ye=Object.prototype.propertyIsEnumerable;var F=(e,t,i)=>t in e?v(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,b=(e,t)=>{for(var i in t||(t={}))_.call(t,i)&&F(e,i,t[i]);if(I)for(var i of I(t))ye.call(t,i)&&F(e,i,t[i]);return e},w=(e,t)=>le(e,ue(t));var K=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ge=(e,t)=>{for(var i in t)v(e,i,{get:t[i],enumerable:!0})},R=(e,t,i,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of fe(t))!_.call(e,u)&&u!==i&&v(e,u,{get:()=>t[u],enumerable:!(c=ce(t,u))||c.enumerable});return e};var x=(e,t,i)=>(i=e!=null?ae(pe(e)):{},R(t||!e||!e.__esModule?v(i,"default",{value:e,enumerable:!0}):i,e)),he=e=>R(v({},"__esModule",{value:!0}),e);var j=(e,t)=>J(v(e,"raw",{value:J(t||e.slice())}));var H=K((V,k)=>{(function(e,t){typeof V=="object"&&typeof k<"u"?k.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self,e.typeDetect=t())})(V,(function(){"use strict";var e=typeof Promise=="function",t=(function(y){if(typeof globalThis=="object")return globalThis;Object.defineProperty(y,"typeDetectGlobalObject",{get:function(){return this},configurable:!0});var $=typeDetectGlobalObject;return delete y.typeDetectGlobalObject,$})(Object.prototype),i=typeof Symbol<"u",c=typeof Map<"u",u=typeof Set<"u",f=typeof WeakMap<"u",l=typeof WeakSet<"u",n=typeof DataView<"u",r=i&&typeof Symbol.iterator<"u",o=i&&typeof Symbol.toStringTag<"u",a=u&&typeof Set.prototype.entries=="function",s=c&&typeof Map.prototype.entries=="function",p=a&&Object.getPrototypeOf(new Set().entries()),d=s&&Object.getPrototypeOf(new Map().entries()),g=r&&typeof Array.prototype[Symbol.iterator]=="function",E=g&&Object.getPrototypeOf([][Symbol.iterator]()),L=r&&typeof String.prototype[Symbol.iterator]=="function",ne=L&&Object.getPrototypeOf(""[Symbol.iterator]()),oe=8,se=-1;function ie(y){var $=typeof y;if($!=="object")return $;if(y===null)return"null";if(y===t)return"global";if(Array.isArray(y)&&(o===!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 D=o&&y[Symbol.toStringTag];if(typeof D=="string")return D;var h=Object.getPrototypeOf(y);return h===RegExp.prototype?"RegExp":h===Date.prototype?"Date":e&&h===Promise.prototype?"Promise":u&&h===Set.prototype?"Set":c&&h===Map.prototype?"Map":l&&h===WeakSet.prototype?"WeakSet":f&&h===WeakMap.prototype?"WeakMap":n&&h===DataView.prototype?"DataView":c&&h===d?"Map Iterator":u&&h===p?"Set Iterator":g&&h===E?"Array Iterator":L&&h===ne?"String Iterator":h===null?"Object":Object.prototype.toString.call(y).slice(oe,se)}return ie}))});var T=K((je,Q)=>{"use strict";Q.exports=de;function S(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}function de(e){if(e=e||{},e.circles)return me(e);let t=new Map;if(t.set(Date,l=>new Date(l)),t.set(Map,(l,n)=>new Map(c(Array.from(l),n))),t.set(Set,(l,n)=>new Set(c(Array.from(l),n))),e.constructorHandlers)for(let l of e.constructorHandlers)t.set(l[0],l[1]);let i=null;return e.proto?f:u;function c(l,n){let r=Object.keys(l),o=new Array(r.length);for(let a=0;a<r.length;a++){let s=r[a],p=l[s];typeof p!="object"||p===null?o[s]=p:p.constructor!==Object&&(i=t.get(p.constructor))?o[s]=i(p,n):ArrayBuffer.isView(p)?o[s]=S(p):o[s]=n(p)}return o}function u(l){if(typeof l!="object"||l===null)return l;if(Array.isArray(l))return c(l,u);if(l.constructor!==Object&&(i=t.get(l.constructor)))return i(l,u);let n={};for(let r in l){if(Object.hasOwnProperty.call(l,r)===!1)continue;let o=l[r];typeof o!="object"||o===null?n[r]=o:o.constructor!==Object&&(i=t.get(o.constructor))?n[r]=i(o,u):ArrayBuffer.isView(o)?n[r]=S(o):n[r]=u(o)}return n}function f(l){if(typeof l!="object"||l===null)return l;if(Array.isArray(l))return c(l,f);if(l.constructor!==Object&&(i=t.get(l.constructor)))return i(l,f);let n={};for(let r in l){let o=l[r];typeof o!="object"||o===null?n[r]=o:o.constructor!==Object&&(i=t.get(o.constructor))?n[r]=i(o,f):ArrayBuffer.isView(o)?n[r]=S(o):n[r]=f(o)}return n}}function me(e){let t=[],i=[],c=new Map;if(c.set(Date,r=>new Date(r)),c.set(Map,(r,o)=>new Map(f(Array.from(r),o))),c.set(Set,(r,o)=>new Set(f(Array.from(r),o))),e.constructorHandlers)for(let r of e.constructorHandlers)c.set(r[0],r[1]);let u=null;return e.proto?n:l;function f(r,o){let a=Object.keys(r),s=new Array(a.length);for(let p=0;p<a.length;p++){let d=a[p],g=r[d];if(typeof g!="object"||g===null)s[d]=g;else if(g.constructor!==Object&&(u=c.get(g.constructor)))s[d]=u(g,o);else if(ArrayBuffer.isView(g))s[d]=S(g);else{let E=t.indexOf(g);E!==-1?s[d]=i[E]:s[d]=o(g)}}return s}function l(r){if(typeof r!="object"||r===null)return r;if(Array.isArray(r))return f(r,l);if(r.constructor!==Object&&(u=c.get(r.constructor)))return u(r,l);let o={};t.push(r),i.push(o);for(let a in r){if(Object.hasOwnProperty.call(r,a)===!1)continue;let s=r[a];if(typeof s!="object"||s===null)o[a]=s;else if(s.constructor!==Object&&(u=c.get(s.constructor)))o[a]=u(s,l);else if(ArrayBuffer.isView(s))o[a]=S(s);else{let p=t.indexOf(s);p!==-1?o[a]=i[p]:o[a]=l(s)}}return t.pop(),i.pop(),o}function n(r){if(typeof r!="object"||r===null)return r;if(Array.isArray(r))return f(r,n);if(r.constructor!==Object&&(u=c.get(r.constructor)))return u(r,n);let o={};t.push(r),i.push(o);for(let a in r){let s=r[a];if(typeof s!="object"||s===null)o[a]=s;else if(s.constructor!==Object&&(u=c.get(s.constructor)))o[a]=u(s,n);else if(ArrayBuffer.isView(s))o[a]=S(s);else{let p=t.indexOf(s);p!==-1?o[a]=i[p]:o[a]=n(s)}}return t.pop(),i.pop(),o}}});var Ee={};ge(Ee,{compare:()=>B,defaults:()=>re,version:()=>Se});var A=x(H(),1);var z=x(T(),1);var q=x(T(),1);var De=(0,q.default)();function O(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 be(e){return typeof e=="string"}function U(e,t){return O(e)&&be(t)&&t in e}function M(e){if(e.includes(".")){let t=e.lastIndexOf(".");if(!e.slice(0,t).includes("."))return e.slice(0,t);for(let i=t-1;i--;)if(e[i]===".")return e.slice(i+1,t)}return null}var C=(0,z.default)();function G(e,t){let i={now:!1};function c(u,f,l,n){let r=C(u),o,a=b({depth:-1,path:""},l);if(a.depth+=1,Array.isArray(r))for(let s=0,p=r.length;s<p&&!n.now;s++){let d=a.path?"".concat(a.path,".").concat(s):"".concat(s);r[s]!==void 0?(a.parent=C(r),a.parentType="array",a.parentKey=M(d),o=c(f(r[s],void 0,w(b({},a),{path:d}),n),f,w(b({},a),{path:d}),n),Number.isNaN(o)&&s<r.length?(r.splice(s,1),s-=1):r[s]=o):r.splice(s,1)}else if(O(r))for(let s in r){if(n.now&&s!=null)break;let p=a.path?"".concat(a.path,".").concat(s):s;a.depth===0&&s!=null&&(a.topmostKey=s),a.parent=C(r),a.parentType="object",a.parentKey=M(p),o=c(f(s,r[s],w(b({},a),{path:p}),n),f,w(b({},a),{path:p}),n),Number.isNaN(o)?delete r[s]:r[s]=o}return r}return c(e,t,{},i)}function m(e){if(typeof e=="string")return!e.trim();if(!["object","string"].includes(typeof e)||!e)return!1;let t=!0;return e=G(e,(i,c,u,f)=>{let l=c!==void 0?c:i;return typeof l=="string"&&l.trim()&&(t=!1,f.now=!0),l}),t}function P(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var W=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 '".concat(t,"' to be a string or an array, but got a type of '").concat(typeof e,"'"))}return e.filter(i=>{if(typeof i!="string"){if(i===void 0)return!1;throw new TypeError("Expected '".concat(t,"' to be an array of strings, but found a type of '").concat(typeof i,"' in the array"))}return!0})},X,Y,ee,Oe=(e,t)=>{t=b({caseSensitive:!1},t);let i="s"+(t.caseSensitive?"":"i"),c=e+"|"+i;if(W.has(c))return W.get(c);let u=e[0]==="!";u&&(e=e.slice(1)),e=e.replaceAll(String.raw(X||(X=j(["*"],["\\*"]))),"__ESCAPED_STAR__").replaceAll("\\\\","__ESCAPED_BACKSLASH__").replaceAll(/\\(.)/g,"$1"),e=P(e).replaceAll(String.raw(Y||(Y=j(["*"],["\\*"]))),".*"),e=e.replaceAll("__ESCAPED_STAR__",String.raw(ee||(ee=j(["*"],["\\*"])))).replaceAll("__ESCAPED_BACKSLASH__","\\\\");let f=new RegExp("^".concat(e,"$"),i);return f.negated=u,W.set(c,f),f},Ae=(e,t,i,c)=>{if(e=Z(e,"inputs"),t=Z(t,"patterns"),t.length===0)return[];t=t.map(r=>Oe(r,i));let u=t.filter(r=>r.negated),f=t.filter(r=>!r.negated),{allPatterns:l}=i||{},n=[];if(l&&c&&u.length>1&&f.length===0){for(let r of e)for(let o of u)if(o.test(r))return[];return e.slice(0,1)}for(let r of e){let o=!1;for(let a of u)if(a.test(r)){o=!0;break}if(!o){if(f.length===0)n.push(r);else if(l){let a=Array.from({length:f.length},()=>!1);for(let[s,p]of f.entries())p.test(r)&&(a[s]=!0);a.every(Boolean)&&n.push(r)}else{let a=!1;for(let s of f)if(s.test(r)){a=!0;break}a&&n.push(r)}if(c&&n.length>0)break}}return n};function N(e,t,i){return Ae(e,t,i,!0).length>0}var te="4.0.41";var Se=te;function we(e){return O(e)?!Object.keys(e).length:Array.isArray(e)||typeof e=="string"?!e.length:!1}var re={hungryForWhitespace:!1,matchStrictly:!1,verboseWhenMismatches:!1,useWildcards:!1};function B(e,t,i){let c,u,f,l=0,n=b(b({},re),i);if(n.hungryForWhitespace&&n.matchStrictly&&O(e)&&m(e)&&O(t)&&!Object.keys(t).length)return!0;if((!n.hungryForWhitespace||n.hungryForWhitespace&&!m(e)&&m(t))&&O(e)&&Object.keys(e).length!==0&&O(t)&&Object.keys(t).length===0||(0,A.default)(e)!==(0,A.default)(t)&&(!n.hungryForWhitespace||n.hungryForWhitespace&&!m(e)))return!1;if(typeof e=="string"&&typeof t=="string")return n.hungryForWhitespace&&m(e)&&m(t)?!0:n.verboseWhenMismatches?e===t?!0:"Given string ".concat(t," is not matched! We have ").concat(e," on the other end."):n.useWildcards?N(e,t,{caseSensitive:!0}):e===t;if(Array.isArray(e)&&Array.isArray(t)){if(n.hungryForWhitespace&&m(t)&&(!n.matchStrictly||n.matchStrictly&&e.length===t.length))return!0;if(!n.hungryForWhitespace&&t.length>e.length||n.matchStrictly&&t.length!==e.length)return n.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:n.verboseWhenMismatches?"The given array has no elements, but the array on the other end, ".concat(JSON.stringify(e,null,4)," does have some"):!1;for(let r=0,o=t.length;r<o;r++){f=!1;for(let a=l,s=e.length;a<s;a++)if(l+=1,B(e[a],t[r],n)===!0){f=!0;break}if(!f)return n.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(O(e)&&O(t)){if(c=new Set(Object.keys(t)),u=new Set(Object.keys(e)),n.matchStrictly&&c.size!==u.size){if(!n.verboseWhenMismatches)return!1;let r=new Set([...c].filter(p=>!u.has(p))),o=r.size?" First object has unique keys: ".concat(JSON.stringify(r,null,4),"."):"",a=new Set([...u].filter(p=>!c.has(p))),s=a.size?" Second object has unique keys:\n ".concat(JSON.stringify(a,null,4),"."):"";return"When matching strictly, we found that both objects have different amount of keys.".concat(o).concat(s)}for(let r of c){if(!U(e,r))return!n.useWildcards||n.useWildcards&&!r.includes("*")?n.verboseWhenMismatches?'The given object has key "'.concat(r,'" which the other-one does not have.'):!1:Object.keys(e).some(o=>N(o,r,{caseSensitive:!0}))?!0:n.verboseWhenMismatches?'The given object has key "'.concat(r,'" which the other-one does not have.'):!1;if(e[r]!=null&&(0,A.default)(e[r])!==(0,A.default)(t[r])){if(!(m(e[r])&&m(t[r])&&n.hungryForWhitespace))return n.verboseWhenMismatches?"The given key ".concat(r," is of a different type on both objects. On the first-one, it's ").concat((0,A.default)(t[r]),", on the second-one, it's ").concat((0,A.default)(e[r])):!1}else if(B(e[r],t[r],n)!==!0)return n.verboseWhenMismatches?"The given piece ".concat(JSON.stringify(t[r],null,4)," and ").concat(JSON.stringify(e[r],null,4)," don't match."):!1}}else return n.hungryForWhitespace&&m(e)&&m(t)&&(!n.matchStrictly||n.matchStrictly&&we(t))?!0:e===t;return!0}return he(Ee);})();
|
|
12
11
|
/**
|
|
13
12
|
* @name codsen-utils
|
|
14
13
|
* @fileoverview Various utility functions
|
|
15
|
-
* @version 1.6.
|
|
14
|
+
* @version 1.6.18
|
|
16
15
|
* @author Roy Revelt, Codsen Ltd
|
|
17
16
|
* @license MIT
|
|
18
17
|
* {@link https://codsen.com/os/codsen-utils/}
|
|
@@ -20,7 +19,7 @@
|
|
|
20
19
|
/**
|
|
21
20
|
* @name ast-monkey-util
|
|
22
21
|
* @fileoverview Utility library of AST helper functions
|
|
23
|
-
* @version 3.0.
|
|
22
|
+
* @version 3.0.20
|
|
24
23
|
* @author Roy Revelt, Codsen Ltd
|
|
25
24
|
* @license MIT
|
|
26
25
|
* {@link https://codsen.com/os/ast-monkey-util/}
|
|
@@ -28,7 +27,7 @@
|
|
|
28
27
|
/**
|
|
29
28
|
* @name ast-monkey-traverse
|
|
30
29
|
* @fileoverview Utility library to traverse AST
|
|
31
|
-
* @version 4.0.
|
|
30
|
+
* @version 4.0.30
|
|
32
31
|
* @author Roy Revelt, Codsen Ltd
|
|
33
32
|
* @license MIT
|
|
34
33
|
* {@link https://codsen.com/os/ast-monkey-traverse/}
|
|
@@ -36,7 +35,7 @@
|
|
|
36
35
|
/**
|
|
37
36
|
* @name ast-contains-only-empty-space
|
|
38
37
|
* @fileoverview Does AST contain only empty space?
|
|
39
|
-
* @version 4.0.
|
|
38
|
+
* @version 4.0.30
|
|
40
39
|
* @author Roy Revelt, Codsen Ltd
|
|
41
40
|
* @license MIT
|
|
42
41
|
* {@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.
|
|
3
|
+
"version": "4.0.41",
|
|
4
4
|
"description": "Compare anything: AST, objects, arrays, strings and nested thereof",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"array",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"dts": "rollup -c && npm run prettier -- 'types/index.d.ts' --write --log-level 'silent'",
|
|
50
50
|
"examples": "node '../../ops/scripts/run-examples.js'",
|
|
51
51
|
"lect": "node '../../ops/lect/lect.js' && npm run prettier -- 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
|
|
52
|
-
"letspublish": "npm publish || :",
|
|
52
|
+
"letspublish": "npm publish --provenance || :",
|
|
53
53
|
"lint": "eslint . --fix",
|
|
54
54
|
"perf": "node perf/check.js",
|
|
55
55
|
"prep": "echo 'ready'",
|
|
@@ -77,13 +77,16 @@
|
|
|
77
77
|
}
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"ast-contains-only-empty-space": "^4.0.
|
|
81
|
-
"codsen-utils": "^1.6.
|
|
82
|
-
"matcher": "^
|
|
80
|
+
"ast-contains-only-empty-space": "^4.0.30",
|
|
81
|
+
"codsen-utils": "^1.6.18",
|
|
82
|
+
"matcher": "^6.0.0",
|
|
83
83
|
"type-detect": "^4.1.0"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
86
|
"@types/type-detect": "^4.0.3",
|
|
87
|
-
"type-fest": "^
|
|
87
|
+
"type-fest": "^5.0.1"
|
|
88
|
+
},
|
|
89
|
+
"publishConfig": {
|
|
90
|
+
"registry": "https://registry.npmjs.org/"
|
|
88
91
|
}
|
|
89
92
|
}
|