ast-compare 2.0.16 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,28 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 3.0.1 (2021-09-13)
7
+
8
+ ### Bug Fixes
9
+
10
+ - bump TS and separate ESLint plugins away from this monorepo ([2e07d42](https://github.com/codsen/codsen/commit/2e07d424222b6ffedf5fb45c83ad453627ec2904))
11
+
12
+ ## 3.0.0 (2021-09-09)
13
+
14
+ ### Features
15
+
16
+ - migrate to ES Modules ([8c9d95d](https://github.com/codsen/codsen/commit/8c9d95d5dea0b769c2f070397141918a4893d575))
17
+
18
+ ### BREAKING CHANGES
19
+
20
+ - programs now are in ES Modules and won't work with Common JS require()
21
+
22
+ ## 2.1.0 (2021-05-24)
23
+
24
+ ### Features
25
+
26
+ - config file based major bump blacklisting ([e15f9bb](https://github.com/codsen/codsen/commit/e15f9bba1c4fd5f847ac28b3f38fa6ee633f5dca))
27
+
6
28
  ## 2.0.15 (2021-04-11)
7
29
 
8
30
  ### Reverts
package/README.md CHANGED
@@ -26,10 +26,14 @@
26
26
 
27
27
  ## Install
28
28
 
29
+ This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required:
30
+
29
31
  ```bash
30
32
  npm i ast-compare
31
33
  ```
32
34
 
35
+ If you need a legacy version which works with `require`, use version 2.1.0
36
+
33
37
  ## Quick Take
34
38
 
35
39
  ```js
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @name ast-compare
3
3
  * @fileoverview Compare anything: AST, objects, arrays, strings and nested thereof
4
- * @version 2.0.16
4
+ * @version 3.0.2
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/ast-compare/}
@@ -1,25 +1,25 @@
1
1
  /**
2
2
  * @name ast-compare
3
3
  * @fileoverview Compare anything: AST, objects, arrays, strings and nested thereof
4
- * @version 2.0.16
4
+ * @version 3.0.2
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
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).astCompare={})}(this,(function(t){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(t){var e={exports:{}};return t(e,e.exports),e.exports}var n=r((function(t,r){t.exports=function(){var t="function"==typeof Promise,r="object"==typeof self?self:e,n="undefined"!=typeof Symbol,o="undefined"!=typeof Map,i="undefined"!=typeof Set,a="undefined"!=typeof WeakMap,c="undefined"!=typeof WeakSet,u="undefined"!=typeof DataView,s=n&&void 0!==Symbol.iterator,f=n&&void 0!==Symbol.toStringTag,l=i&&"function"==typeof Set.prototype.entries,p=o&&"function"==typeof Map.prototype.entries,y=l&&Object.getPrototypeOf((new Set).entries()),h=p&&Object.getPrototypeOf((new Map).entries()),d=s&&"function"==typeof Array.prototype[Symbol.iterator],g=d&&Object.getPrototypeOf([][Symbol.iterator]()),b=s&&"function"==typeof String.prototype[Symbol.iterator],v=b&&Object.getPrototypeOf(""[Symbol.iterator]()),_=8,j=-1;function w(e){var n=typeof e;if("object"!==n)return n;if(null===e)return"null";if(e===r)return"global";if(Array.isArray(e)&&(!1===f||!(Symbol.toStringTag in e)))return"Array";if("object"==typeof window&&null!==window){if("object"==typeof window.location&&e===window.location)return"Location";if("object"==typeof window.document&&e===window.document)return"Document";if("object"==typeof window.navigator){if("object"==typeof window.navigator.mimeTypes&&e===window.navigator.mimeTypes)return"MimeTypeArray";if("object"==typeof window.navigator.plugins&&e===window.navigator.plugins)return"PluginArray"}if(("function"==typeof window.HTMLElement||"object"==typeof window.HTMLElement)&&e instanceof window.HTMLElement){if("BLOCKQUOTE"===e.tagName)return"HTMLQuoteElement";if("TD"===e.tagName)return"HTMLTableDataCellElement";if("TH"===e.tagName)return"HTMLTableHeaderCellElement"}}var s=f&&e[Symbol.toStringTag];if("string"==typeof s)return s;var l=Object.getPrototypeOf(e);return l===RegExp.prototype?"RegExp":l===Date.prototype?"Date":t&&l===Promise.prototype?"Promise":i&&l===Set.prototype?"Set":o&&l===Map.prototype?"Map":c&&l===WeakSet.prototype?"WeakSet":a&&l===WeakMap.prototype?"WeakMap":u&&l===DataView.prototype?"DataView":o&&l===h?"Map Iterator":i&&l===y?"Set Iterator":d&&l===g?"Array Iterator":b&&l===v?"String Iterator":null===l?"Object":Object.prototype.toString.call(e).slice(_,j)}return w}()})),o=r((function(t,r){var n="__lodash_hash_undefined__",o=9007199254740991,i="[object Arguments]",a="[object Boolean]",c="[object Date]",u="[object Function]",s="[object GeneratorFunction]",f="[object Map]",l="[object Number]",p="[object Object]",y="[object Promise]",h="[object RegExp]",d="[object Set]",g="[object String]",b="[object Symbol]",v="[object WeakMap]",_="[object ArrayBuffer]",j="[object DataView]",w="[object Float32Array]",m="[object Float64Array]",O="[object Int8Array]",S="[object Int16Array]",$="[object Int32Array]",A="[object Uint8Array]",T="[object Uint8ClampedArray]",M="[object Uint16Array]",W="[object Uint32Array]",k=/\w*$/,x=/^\[object .+?Constructor\]$/,E=/^(?:0|[1-9]\d*)$/,N={};N[i]=N["[object Array]"]=N[_]=N[j]=N[a]=N[c]=N[w]=N[m]=N[O]=N[S]=N[$]=N[f]=N[l]=N[p]=N[h]=N[d]=N[g]=N[b]=N[A]=N[T]=N[M]=N[W]=!0,N["[object Error]"]=N[u]=N[v]=!1;var P="object"==typeof self&&self&&self.Object===Object&&self,F="object"==typeof e&&e&&e.Object===Object&&e||P||Function("return this")(),I=r&&!r.nodeType&&r,D=I&&t&&!t.nodeType&&t,J=D&&D.exports===I;function L(t,e){return t.set(e[0],e[1]),t}function H(t,e){return t.add(e),t}function z(t,e,r,n){var o=-1,i=t?t.length:0;for(n&&i&&(r=t[++o]);++o<i;)r=e(r,t[o],o,t);return r}function B(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function C(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}function R(t,e){return function(r){return t(e(r))}}function U(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}var V,K=Array.prototype,q=Function.prototype,G=Object.prototype,Q=F["__core-js_shared__"],X=(V=/[^.]+$/.exec(Q&&Q.keys&&Q.keys.IE_PROTO||""))?"Symbol(src)_1."+V:"",Y=q.toString,Z=G.hasOwnProperty,tt=G.toString,et=RegExp("^"+Y.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),rt=J?F.Buffer:void 0,nt=F.Symbol,ot=F.Uint8Array,it=R(Object.getPrototypeOf,Object),at=Object.create,ct=G.propertyIsEnumerable,ut=K.splice,st=Object.getOwnPropertySymbols,ft=rt?rt.isBuffer:void 0,lt=R(Object.keys,Object),pt=Dt(F,"DataView"),yt=Dt(F,"Map"),ht=Dt(F,"Promise"),dt=Dt(F,"Set"),gt=Dt(F,"WeakMap"),bt=Dt(Object,"create"),vt=Bt(pt),_t=Bt(yt),jt=Bt(ht),wt=Bt(dt),mt=Bt(gt),Ot=nt?nt.prototype:void 0,St=Ot?Ot.valueOf:void 0;function $t(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function At(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Tt(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Mt(t){this.__data__=new At(t)}function Wt(t,e){var r=Rt(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&Ut(t)}(t)&&Z.call(t,"callee")&&(!ct.call(t,"callee")||tt.call(t)==i)}(t)?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],n=r.length,o=!!n;for(var a in t)!e&&!Z.call(t,a)||o&&("length"==a||Ht(a,n))||r.push(a);return r}function kt(t,e,r){var n=t[e];Z.call(t,e)&&Ct(n,r)&&(void 0!==r||e in t)||(t[e]=r)}function xt(t,e){for(var r=t.length;r--;)if(Ct(t[r][0],e))return r;return-1}function Et(t,e,r,n,o,y,v){var x;if(n&&(x=y?n(t,o,y,v):n(t)),void 0!==x)return x;if(!qt(t))return t;var E=Rt(t);if(E){if(x=function(t){var e=t.length,r=t.constructor(e);e&&"string"==typeof t[0]&&Z.call(t,"index")&&(r.index=t.index,r.input=t.input);return r}(t),!e)return function(t,e){var r=-1,n=t.length;e||(e=Array(n));for(;++r<n;)e[r]=t[r];return e}(t,x)}else{var P=Lt(t),F=P==u||P==s;if(Vt(t))return function(t,e){if(e)return t.slice();var r=new t.constructor(t.length);return t.copy(r),r}(t,e);if(P==p||P==i||F&&!y){if(B(t))return y?t:{};if(x=function(t){return"function"!=typeof t.constructor||zt(t)?{}:(e=it(t),qt(e)?at(e):{});var e}(F?{}:t),!e)return function(t,e){return Ft(t,Jt(t),e)}(t,function(t,e){return t&&Ft(e,Gt(e),t)}(x,t))}else{if(!N[P])return y?t:{};x=function(t,e,r,n){var o=t.constructor;switch(e){case _:return Pt(t);case a:case c:return new o(+t);case j:return function(t,e){var r=e?Pt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,n);case w:case m:case O:case S:case $:case A:case T:case M:case W:return function(t,e){var r=e?Pt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}(t,n);case f:return function(t,e,r){return z(e?r(C(t),!0):C(t),L,new t.constructor)}(t,n,r);case l:case g:return new o(t);case h:return function(t){var e=new t.constructor(t.source,k.exec(t));return e.lastIndex=t.lastIndex,e}(t);case d:return function(t,e,r){return z(e?r(U(t),!0):U(t),H,new t.constructor)}(t,n,r);case b:return i=t,St?Object(St.call(i)):{}}var i}(t,P,Et,e)}}v||(v=new Mt);var I=v.get(t);if(I)return I;if(v.set(t,x),!E)var D=r?function(t){return function(t,e,r){var n=e(t);return Rt(t)?n:function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}(n,r(t))}(t,Gt,Jt)}(t):Gt(t);return function(t,e){for(var r=-1,n=t?t.length:0;++r<n&&!1!==e(t[r],r,t););}(D||t,(function(o,i){D&&(o=t[i=o]),kt(x,i,Et(o,e,r,n,i,t,v))})),x}function Nt(t){return!(!qt(t)||(e=t,X&&X in e))&&(Kt(t)||B(t)?et:x).test(Bt(t));var e}function Pt(t){var e=new t.constructor(t.byteLength);return new ot(e).set(new ot(t)),e}function Ft(t,e,r,n){r||(r={});for(var o=-1,i=e.length;++o<i;){var a=e[o],c=n?n(r[a],t[a],a,r,t):void 0;kt(r,a,void 0===c?t[a]:c)}return r}function It(t,e){var r,n,o=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof e?"string":"hash"]:o.map}function Dt(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return Nt(r)?r:void 0}$t.prototype.clear=function(){this.__data__=bt?bt(null):{}},$t.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},$t.prototype.get=function(t){var e=this.__data__;if(bt){var r=e[t];return r===n?void 0:r}return Z.call(e,t)?e[t]:void 0},$t.prototype.has=function(t){var e=this.__data__;return bt?void 0!==e[t]:Z.call(e,t)},$t.prototype.set=function(t,e){return this.__data__[t]=bt&&void 0===e?n:e,this},At.prototype.clear=function(){this.__data__=[]},At.prototype.delete=function(t){var e=this.__data__,r=xt(e,t);return!(r<0)&&(r==e.length-1?e.pop():ut.call(e,r,1),!0)},At.prototype.get=function(t){var e=this.__data__,r=xt(e,t);return r<0?void 0:e[r][1]},At.prototype.has=function(t){return xt(this.__data__,t)>-1},At.prototype.set=function(t,e){var r=this.__data__,n=xt(r,t);return n<0?r.push([t,e]):r[n][1]=e,this},Tt.prototype.clear=function(){this.__data__={hash:new $t,map:new(yt||At),string:new $t}},Tt.prototype.delete=function(t){return It(this,t).delete(t)},Tt.prototype.get=function(t){return It(this,t).get(t)},Tt.prototype.has=function(t){return It(this,t).has(t)},Tt.prototype.set=function(t,e){return It(this,t).set(t,e),this},Mt.prototype.clear=function(){this.__data__=new At},Mt.prototype.delete=function(t){return this.__data__.delete(t)},Mt.prototype.get=function(t){return this.__data__.get(t)},Mt.prototype.has=function(t){return this.__data__.has(t)},Mt.prototype.set=function(t,e){var r=this.__data__;if(r instanceof At){var n=r.__data__;if(!yt||n.length<199)return n.push([t,e]),this;r=this.__data__=new Tt(n)}return r.set(t,e),this};var Jt=st?R(st,Object):function(){return[]},Lt=function(t){return tt.call(t)};function Ht(t,e){return!!(e=null==e?o:e)&&("number"==typeof t||E.test(t))&&t>-1&&t%1==0&&t<e}function zt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||G)}function Bt(t){if(null!=t){try{return Y.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Ct(t,e){return t===e||t!=t&&e!=e}(pt&&Lt(new pt(new ArrayBuffer(1)))!=j||yt&&Lt(new yt)!=f||ht&&Lt(ht.resolve())!=y||dt&&Lt(new dt)!=d||gt&&Lt(new gt)!=v)&&(Lt=function(t){var e=tt.call(t),r=e==p?t.constructor:void 0,n=r?Bt(r):void 0;if(n)switch(n){case vt:return j;case _t:return f;case jt:return y;case wt:return d;case mt:return v}return e});var Rt=Array.isArray;function Ut(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=o}(t.length)&&!Kt(t)}var Vt=ft||function(){return!1};function Kt(t){var e=qt(t)?tt.call(t):"";return e==u||e==s}function qt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Gt(t){return Ut(t)?Wt(t):function(t){if(!zt(t))return lt(t);var e=[];for(var r in Object(t))Z.call(t,r)&&"constructor"!=r&&e.push(r);return e}(t)}t.exports=function(t){return Et(t,!0,!0)}}));var i,a,c=Object.prototype,u=Function.prototype.toString,s=c.hasOwnProperty,f=u.call(Object),l=c.toString,p=(i=Object.getPrototypeOf,a=Object,function(t){return i(a(t))});var y=function(t){if(!function(t){return!!t&&"object"==typeof t}(t)||"[object Object]"!=l.call(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t))return!1;var e=p(t);if(null===e)return!0;var r=s.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&u.call(r)==f};
10
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).astCompare={})}(this,(function(t){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r={exports:{}};!function(t,r){t.exports=function(){var t="function"==typeof Promise,r="object"==typeof self?self:e,n="undefined"!=typeof Symbol,o="undefined"!=typeof Map,i="undefined"!=typeof Set,a="undefined"!=typeof WeakMap,c="undefined"!=typeof WeakSet,u="undefined"!=typeof DataView,s=n&&void 0!==Symbol.iterator,f=n&&void 0!==Symbol.toStringTag,l=i&&"function"==typeof Set.prototype.entries,p=o&&"function"==typeof Map.prototype.entries,y=l&&Object.getPrototypeOf((new Set).entries()),h=p&&Object.getPrototypeOf((new Map).entries()),d=s&&"function"==typeof Array.prototype[Symbol.iterator],g=d&&Object.getPrototypeOf([][Symbol.iterator]()),b=s&&"function"==typeof String.prototype[Symbol.iterator],v=b&&Object.getPrototypeOf(""[Symbol.iterator]()),_=8,j=-1;function w(e){var n=typeof e;if("object"!==n)return n;if(null===e)return"null";if(e===r)return"global";if(Array.isArray(e)&&(!1===f||!(Symbol.toStringTag in e)))return"Array";if("object"==typeof window&&null!==window){if("object"==typeof window.location&&e===window.location)return"Location";if("object"==typeof window.document&&e===window.document)return"Document";if("object"==typeof window.navigator){if("object"==typeof window.navigator.mimeTypes&&e===window.navigator.mimeTypes)return"MimeTypeArray";if("object"==typeof window.navigator.plugins&&e===window.navigator.plugins)return"PluginArray"}if(("function"==typeof window.HTMLElement||"object"==typeof window.HTMLElement)&&e instanceof window.HTMLElement){if("BLOCKQUOTE"===e.tagName)return"HTMLQuoteElement";if("TD"===e.tagName)return"HTMLTableDataCellElement";if("TH"===e.tagName)return"HTMLTableHeaderCellElement"}}var s=f&&e[Symbol.toStringTag];if("string"==typeof s)return s;var l=Object.getPrototypeOf(e);return l===RegExp.prototype?"RegExp":l===Date.prototype?"Date":t&&l===Promise.prototype?"Promise":i&&l===Set.prototype?"Set":o&&l===Map.prototype?"Map":c&&l===WeakSet.prototype?"WeakSet":a&&l===WeakMap.prototype?"WeakMap":u&&l===DataView.prototype?"DataView":o&&l===h?"Map Iterator":i&&l===y?"Set Iterator":d&&l===g?"Array Iterator":b&&l===v?"String Iterator":null===l?"Object":Object.prototype.toString.call(e).slice(_,j)}return w}()}(r);var n=r.exports,o={exports:{}};!function(t,r){var n="__lodash_hash_undefined__",o=9007199254740991,i="[object Arguments]",a="[object Boolean]",c="[object Date]",u="[object Function]",s="[object GeneratorFunction]",f="[object Map]",l="[object Number]",p="[object Object]",y="[object Promise]",h="[object RegExp]",d="[object Set]",g="[object String]",b="[object Symbol]",v="[object WeakMap]",_="[object ArrayBuffer]",j="[object DataView]",w="[object Float32Array]",m="[object Float64Array]",O="[object Int8Array]",S="[object Int16Array]",$="[object Int32Array]",A="[object Uint8Array]",T="[object Uint8ClampedArray]",M="[object Uint16Array]",W="[object Uint32Array]",x=/\w*$/,k=/^\[object .+?Constructor\]$/,E=/^(?:0|[1-9]\d*)$/,N={};N[i]=N["[object Array]"]=N[_]=N[j]=N[a]=N[c]=N[w]=N[m]=N[O]=N[S]=N[$]=N[f]=N[l]=N[p]=N[h]=N[d]=N[g]=N[b]=N[A]=N[T]=N[M]=N[W]=!0,N["[object Error]"]=N[u]=N[v]=!1;var P="object"==typeof self&&self&&self.Object===Object&&self,F="object"==typeof e&&e&&e.Object===Object&&e||P||Function("return this")(),I=r&&!r.nodeType&&r,D=I&&t&&!t.nodeType&&t,J=D&&D.exports===I;function L(t,e){return t.set(e[0],e[1]),t}function H(t,e){return t.add(e),t}function z(t,e,r,n){var o=-1,i=t?t.length:0;for(n&&i&&(r=t[++o]);++o<i;)r=e(r,t[o],o,t);return r}function B(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function C(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}function R(t,e){return function(r){return t(e(r))}}function U(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}var V,K=Array.prototype,q=Function.prototype,G=Object.prototype,Q=F["__core-js_shared__"],X=(V=/[^.]+$/.exec(Q&&Q.keys&&Q.keys.IE_PROTO||""))?"Symbol(src)_1."+V:"",Y=q.toString,Z=G.hasOwnProperty,tt=G.toString,et=RegExp("^"+Y.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),rt=J?F.Buffer:void 0,nt=F.Symbol,ot=F.Uint8Array,it=R(Object.getPrototypeOf,Object),at=Object.create,ct=G.propertyIsEnumerable,ut=K.splice,st=Object.getOwnPropertySymbols,ft=rt?rt.isBuffer:void 0,lt=R(Object.keys,Object),pt=Dt(F,"DataView"),yt=Dt(F,"Map"),ht=Dt(F,"Promise"),dt=Dt(F,"Set"),gt=Dt(F,"WeakMap"),bt=Dt(Object,"create"),vt=Bt(pt),_t=Bt(yt),jt=Bt(ht),wt=Bt(dt),mt=Bt(gt),Ot=nt?nt.prototype:void 0,St=Ot?Ot.valueOf:void 0;function $t(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function At(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Tt(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Mt(t){this.__data__=new At(t)}function Wt(t,e){var r=Rt(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&Ut(t)}(t)&&Z.call(t,"callee")&&(!ct.call(t,"callee")||tt.call(t)==i)}(t)?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],n=r.length,o=!!n;for(var a in t)!e&&!Z.call(t,a)||o&&("length"==a||Ht(a,n))||r.push(a);return r}function xt(t,e,r){var n=t[e];Z.call(t,e)&&Ct(n,r)&&(void 0!==r||e in t)||(t[e]=r)}function kt(t,e){for(var r=t.length;r--;)if(Ct(t[r][0],e))return r;return-1}function Et(t,e,r,n,o,y,v){var k;if(n&&(k=y?n(t,o,y,v):n(t)),void 0!==k)return k;if(!qt(t))return t;var E=Rt(t);if(E){if(k=function(t){var e=t.length,r=t.constructor(e);e&&"string"==typeof t[0]&&Z.call(t,"index")&&(r.index=t.index,r.input=t.input);return r}(t),!e)return function(t,e){var r=-1,n=t.length;e||(e=Array(n));for(;++r<n;)e[r]=t[r];return e}(t,k)}else{var P=Lt(t),F=P==u||P==s;if(Vt(t))return function(t,e){if(e)return t.slice();var r=new t.constructor(t.length);return t.copy(r),r}(t,e);if(P==p||P==i||F&&!y){if(B(t))return y?t:{};if(k=function(t){return"function"!=typeof t.constructor||zt(t)?{}:(e=it(t),qt(e)?at(e):{});var e}(F?{}:t),!e)return function(t,e){return Ft(t,Jt(t),e)}(t,function(t,e){return t&&Ft(e,Gt(e),t)}(k,t))}else{if(!N[P])return y?t:{};k=function(t,e,r,n){var o=t.constructor;switch(e){case _:return Pt(t);case a:case c:return new o(+t);case j:return function(t,e){var r=e?Pt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,n);case w:case m:case O:case S:case $:case A:case T:case M:case W:return function(t,e){var r=e?Pt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}(t,n);case f:return function(t,e,r){return z(e?r(C(t),!0):C(t),L,new t.constructor)}(t,n,r);case l:case g:return new o(t);case h:return function(t){var e=new t.constructor(t.source,x.exec(t));return e.lastIndex=t.lastIndex,e}(t);case d:return function(t,e,r){return z(e?r(U(t),!0):U(t),H,new t.constructor)}(t,n,r);case b:return i=t,St?Object(St.call(i)):{}}var i}(t,P,Et,e)}}v||(v=new Mt);var I=v.get(t);if(I)return I;if(v.set(t,k),!E)var D=r?function(t){return function(t,e,r){var n=e(t);return Rt(t)?n:function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}(n,r(t))}(t,Gt,Jt)}(t):Gt(t);return function(t,e){for(var r=-1,n=t?t.length:0;++r<n&&!1!==e(t[r],r,t););}(D||t,(function(o,i){D&&(o=t[i=o]),xt(k,i,Et(o,e,r,n,i,t,v))})),k}function Nt(t){return!(!qt(t)||(e=t,X&&X in e))&&(Kt(t)||B(t)?et:k).test(Bt(t));var e}function Pt(t){var e=new t.constructor(t.byteLength);return new ot(e).set(new ot(t)),e}function Ft(t,e,r,n){r||(r={});for(var o=-1,i=e.length;++o<i;){var a=e[o],c=n?n(r[a],t[a],a,r,t):void 0;xt(r,a,void 0===c?t[a]:c)}return r}function It(t,e){var r,n,o=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof e?"string":"hash"]:o.map}function Dt(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return Nt(r)?r:void 0}$t.prototype.clear=function(){this.__data__=bt?bt(null):{}},$t.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},$t.prototype.get=function(t){var e=this.__data__;if(bt){var r=e[t];return r===n?void 0:r}return Z.call(e,t)?e[t]:void 0},$t.prototype.has=function(t){var e=this.__data__;return bt?void 0!==e[t]:Z.call(e,t)},$t.prototype.set=function(t,e){return this.__data__[t]=bt&&void 0===e?n:e,this},At.prototype.clear=function(){this.__data__=[]},At.prototype.delete=function(t){var e=this.__data__,r=kt(e,t);return!(r<0)&&(r==e.length-1?e.pop():ut.call(e,r,1),!0)},At.prototype.get=function(t){var e=this.__data__,r=kt(e,t);return r<0?void 0:e[r][1]},At.prototype.has=function(t){return kt(this.__data__,t)>-1},At.prototype.set=function(t,e){var r=this.__data__,n=kt(r,t);return n<0?r.push([t,e]):r[n][1]=e,this},Tt.prototype.clear=function(){this.__data__={hash:new $t,map:new(yt||At),string:new $t}},Tt.prototype.delete=function(t){return It(this,t).delete(t)},Tt.prototype.get=function(t){return It(this,t).get(t)},Tt.prototype.has=function(t){return It(this,t).has(t)},Tt.prototype.set=function(t,e){return It(this,t).set(t,e),this},Mt.prototype.clear=function(){this.__data__=new At},Mt.prototype.delete=function(t){return this.__data__.delete(t)},Mt.prototype.get=function(t){return this.__data__.get(t)},Mt.prototype.has=function(t){return this.__data__.has(t)},Mt.prototype.set=function(t,e){var r=this.__data__;if(r instanceof At){var n=r.__data__;if(!yt||n.length<199)return n.push([t,e]),this;r=this.__data__=new Tt(n)}return r.set(t,e),this};var Jt=st?R(st,Object):function(){return[]},Lt=function(t){return tt.call(t)};function Ht(t,e){return!!(e=null==e?o:e)&&("number"==typeof t||E.test(t))&&t>-1&&t%1==0&&t<e}function zt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||G)}function Bt(t){if(null!=t){try{return Y.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Ct(t,e){return t===e||t!=t&&e!=e}(pt&&Lt(new pt(new ArrayBuffer(1)))!=j||yt&&Lt(new yt)!=f||ht&&Lt(ht.resolve())!=y||dt&&Lt(new dt)!=d||gt&&Lt(new gt)!=v)&&(Lt=function(t){var e=tt.call(t),r=e==p?t.constructor:void 0,n=r?Bt(r):void 0;if(n)switch(n){case vt:return j;case _t:return f;case jt:return y;case wt:return d;case mt:return v}return e});var Rt=Array.isArray;function Ut(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=o}(t.length)&&!Kt(t)}var Vt=ft||function(){return!1};function Kt(t){var e=qt(t)?tt.call(t):"";return e==u||e==s}function qt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Gt(t){return Ut(t)?Wt(t):function(t){if(!zt(t))return lt(t);var e=[];for(var r in Object(t))Z.call(t,r)&&"constructor"!=r&&e.push(r);return e}(t)}t.exports=function(t){return Et(t,!0,!0)}}(o,o.exports);var i=o.exports;var a,c,u=Object.prototype,s=Function.prototype.toString,f=u.hasOwnProperty,l=s.call(Object),p=u.toString,y=(a=Object.getPrototypeOf,c=Object,function(t){return a(c(t))});var h=function(t){if(!function(t){return!!t&&"object"==typeof t}(t)||"[object Object]"!=p.call(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t))return!1;var e=y(t);if(null===e)return!0;var r=f.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&s.call(r)==l};
11
11
  /**
12
12
  * @name ast-monkey-util
13
13
  * @fileoverview Utility library of AST helper functions
14
- * @version 1.3.16
14
+ * @version 2.0.2
15
15
  * @author Roy Revelt, Codsen Ltd
16
16
  * @license MIT
17
17
  * {@link https://codsen.com/os/ast-monkey-util/}
18
- */function h(t){if(t.includes(".")){const e=t.lastIndexOf(".");if(!t.slice(0,e).includes("."))return t.slice(0,e);for(let r=e-1;r--;)if("."===t[r])return t.slice(r+1,e)}return null}
18
+ */function d(t){if(t.includes(".")){const e=t.lastIndexOf(".");if(!t.slice(0,e).includes("."))return t.slice(0,e);for(let r=e-1;r--;)if("."===t[r])return t.slice(r+1,e)}return null}
19
19
  /**
20
20
  * @name ast-monkey-traverse
21
21
  * @fileoverview Utility library to traverse AST
22
- * @version 2.0.16
22
+ * @version 3.0.2
23
23
  * @author Roy Revelt, Codsen Ltd
24
24
  * @license MIT
25
25
  * {@link https://codsen.com/os/ast-monkey-traverse/}
@@ -27,9 +27,9 @@
27
27
  /**
28
28
  * @name ast-contains-only-empty-space
29
29
  * @fileoverview Does AST contain only empty space?
30
- * @version 2.0.16
30
+ * @version 3.0.2
31
31
  * @author Roy Revelt, Codsen Ltd
32
32
  * @license MIT
33
33
  * {@link https://codsen.com/os/ast-contains-only-empty-space/}
34
34
  */
35
- function d(t){if("string"==typeof t)return!t.trim();if(!["object","string"].includes(typeof t)||!t)return!1;let e=!0;return t=function t(e,r,n,i){const a=o(e);let c;const u={depth:-1,path:"",...n};if(u.depth+=1,Array.isArray(a))for(let e=0,n=a.length;e<n&&!i.now;e++){const n=u.path?`${u.path}.${e}`:`${e}`;void 0!==a[e]?(u.parent=o(a),u.parentType="array",u.parentKey=h(n),c=t(r(a[e],void 0,{...u,path:n},i),r,{...u,path:n},i),Number.isNaN(c)&&e<a.length?(a.splice(e,1),e-=1):a[e]=c):a.splice(e,1)}else if(y(a))for(const e in a){if(i.now&&null!=e)break;const n=u.path?`${u.path}.${e}`:e;0===u.depth&&null!=e&&(u.topmostKey=e),u.parent=o(a),u.parentType="object",u.parentKey=h(n),c=t(r(e,a[e],{...u,path:n},i),r,{...u,path:n},i),Number.isNaN(c)?delete a[e]:a[e]=c}return a}(t,((t,r,n,o)=>{const i=void 0!==r?r:t;return"string"==typeof i&&i.trim()&&(e=!1,o.now=!0),i}),{},{now:!1}),e}const g=new Map;function b(t,e){if(!Array.isArray(t))switch(typeof t){case"string":t=[t];break;case"undefined":t=[];break;default:throw new TypeError(`Expected '${e}' to be a string or an array, but got a type of '${typeof t}'`)}return t.filter((t=>{if("string"!=typeof t){if(void 0===t)return!1;throw new TypeError(`Expected '${e}' to be an array of strings, but found a type of '${typeof t}' in the array`)}return!0}))}function v(t,e){e={caseSensitive:!1,...e};const r=t+JSON.stringify(e);if(g.has(r))return g.get(r);const n="!"===t[0];n&&(t=t.slice(1)),t=(t=>{if("string"!=typeof t)throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")})(t).replace(/\\\*/g,"[\\s\\S]*");const o=new RegExp(`^${t}$`,e.caseSensitive?"":"i");return o.negated=n,g.set(r,o),o}var _=(t,e,r)=>{if(t=b(t,"inputs"),0===(e=b(e,"patterns")).length)return[];const n="!"===e[0][0];e=e.map((t=>v(t,r)));const o=[];for(const r of t){let t=n;for(const n of e)n.test(r)&&(t=!n.negated);t&&o.push(r)}return o};_.isMatch=(t,e,r)=>(t=b(t,"inputs"),0!==(e=b(e,"patterns")).length&&t.some((t=>e.every((e=>{const n=v(e,r),o=n.test(t);return n.negated?!o:o}))))),t.compare=function t(e,r,o){let i,a,c,u=0;const s={hungryForWhitespace:!1,matchStrictly:!1,verboseWhenMismatches:!1,useWildcards:!1,...o};if(s.hungryForWhitespace&&s.matchStrictly&&y(e)&&d(e)&&y(r)&&!Object.keys(r).length)return!0;if((!s.hungryForWhitespace||s.hungryForWhitespace&&!d(e)&&d(r))&&y(e)&&0!==Object.keys(e).length&&y(r)&&0===Object.keys(r).length||n(e)!==n(r)&&(!s.hungryForWhitespace||s.hungryForWhitespace&&!d(e)))return!1;if("string"==typeof e&&"string"==typeof r)return!!(s.hungryForWhitespace&&d(e)&&d(r))||(s.verboseWhenMismatches?e===r||`Given string ${r} is not matched! We have ${e} on the other end.`:s.useWildcards?_.isMatch(e,r,{caseSensitive:!0}):e===r);if(Array.isArray(e)&&Array.isArray(r)){if(s.hungryForWhitespace&&d(r)&&(!s.matchStrictly||s.matchStrictly&&e.length===r.length))return!0;if(!s.hungryForWhitespace&&r.length>e.length||s.matchStrictly&&r.length!==e.length)return!!s.verboseWhenMismatches&&`The length of a given array, ${JSON.stringify(r,null,4)} is ${r.length} but the length of an array on the other end, ${JSON.stringify(e,null,4)} is ${e.length}`;if(0===r.length)return 0===e.length||!!s.verboseWhenMismatches&&`The given array has no elements, but the array on the other end, ${JSON.stringify(e,null,4)} does have some`;for(let n=0,o=r.length;n<o;n++){c=!1;for(let o=u,i=e.length;o<i;o++)if(u+=1,!0===t(e[o],r[n],s)){c=!0;break}if(!c)return!!s.verboseWhenMismatches&&`The given array ${JSON.stringify(r,null,4)} is not a subset of an array on the other end, ${JSON.stringify(e,null,4)}`}}else{if(!y(e)||!y(r))return!(!(s.hungryForWhitespace&&d(e)&&d(r))||s.matchStrictly&&(!s.matchStrictly||(f=r,y(f)?Object.keys(f).length:!Array.isArray(f)&&"string"!=typeof f||f.length)))||e===r;if(i=new Set(Object.keys(r)),a=new Set(Object.keys(e)),s.matchStrictly&&i.size!==a.size){if(!s.verboseWhenMismatches)return!1;const t=new Set([...i].filter((t=>!a.has(t)))),e=t.size?` First object has unique keys: ${JSON.stringify(t,null,4)}.`:"",r=new Set([...a].filter((t=>!i.has(t))));return`When matching strictly, we found that both objects have different amount of keys.${e}${r.size?` Second object has unique keys:\n ${JSON.stringify(r,null,4)}.`:""}`}for(const o of i){if(!Object.prototype.hasOwnProperty.call(e,o))return!s.useWildcards||s.useWildcards&&!o.includes("*")?!!s.verboseWhenMismatches&&`The given object has key "${o}" which the other-one does not have.`:!!Object.keys(e).some((t=>_.isMatch(t,o,{caseSensitive:!0})))||!!s.verboseWhenMismatches&&`The given object has key "${o}" which the other-one does not have.`;if(null!=e[o]&&n(e[o])!==n(r[o])){if(!(d(e[o])&&d(r[o])&&s.hungryForWhitespace))return!!s.verboseWhenMismatches&&`The given key ${o} is of a different type on both objects. On the first-one, it's ${n(r[o])}, on the second-one, it's ${n(e[o])}`}else if(!0!==t(e[o],r[o],s))return!!s.verboseWhenMismatches&&`The given piece ${JSON.stringify(r[o],null,4)} and ${JSON.stringify(e[o],null,4)} don't match.`}}var f;return!0},Object.defineProperty(t,"__esModule",{value:!0})}));
35
+ function g(t){if("string"==typeof t)return!t.trim();if(!["object","string"].includes(typeof t)||!t)return!1;let e=!0;return t=function t(e,r,n,o){const a=i(e);let c;const u={depth:-1,path:"",...n};if(u.depth+=1,Array.isArray(a))for(let e=0,n=a.length;e<n&&!o.now;e++){const n=u.path?`${u.path}.${e}`:`${e}`;void 0!==a[e]?(u.parent=i(a),u.parentType="array",u.parentKey=d(n),c=t(r(a[e],void 0,{...u,path:n},o),r,{...u,path:n},o),Number.isNaN(c)&&e<a.length?(a.splice(e,1),e-=1):a[e]=c):a.splice(e,1)}else if(h(a))for(const e in a){if(o.now&&null!=e)break;const n=u.path?`${u.path}.${e}`:e;0===u.depth&&null!=e&&(u.topmostKey=e),u.parent=i(a),u.parentType="object",u.parentKey=d(n),c=t(r(e,a[e],{...u,path:n},o),r,{...u,path:n},o),Number.isNaN(c)?delete a[e]:a[e]=c}return a}(t,((t,r,n,o)=>{const i=void 0!==r?r:t;return"string"==typeof i&&i.trim()&&(e=!1,o.now=!0),i}),{},{now:!1}),e}var b={exports:{}};const v=t=>{if("string"!=typeof t)throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")},_=new Map;function j(t,e){if(!Array.isArray(t))switch(typeof t){case"string":t=[t];break;case"undefined":t=[];break;default:throw new TypeError(`Expected '${e}' to be a string or an array, but got a type of '${typeof t}'`)}return t.filter((t=>{if("string"!=typeof t){if(void 0===t)return!1;throw new TypeError(`Expected '${e}' to be an array of strings, but found a type of '${typeof t}' in the array`)}return!0}))}function w(t,e){e={caseSensitive:!1,...e};const r=t+JSON.stringify(e);if(_.has(r))return _.get(r);const n="!"===t[0];n&&(t=t.slice(1)),t=v(t).replace(/\\\*/g,"[\\s\\S]*");const o=new RegExp(`^${t}$`,e.caseSensitive?"":"i");return o.negated=n,_.set(r,o),o}b.exports=(t,e,r)=>{if(t=j(t,"inputs"),0===(e=j(e,"patterns")).length)return[];const n="!"===e[0][0];e=e.map((t=>w(t,r)));const o=[];for(const r of t){let t=n;for(const n of e)n.test(r)&&(t=!n.negated);t&&o.push(r)}return o},b.exports.isMatch=(t,e,r)=>(t=j(t,"inputs"),0!==(e=j(e,"patterns")).length&&t.some((t=>e.every((e=>{const n=w(e,r),o=n.test(t);return n.negated?!o:o})))));var m=b.exports;t.compare=function t(e,r,o){let i,a,c,u=0;const s={hungryForWhitespace:!1,matchStrictly:!1,verboseWhenMismatches:!1,useWildcards:!1,...o};if(s.hungryForWhitespace&&s.matchStrictly&&h(e)&&g(e)&&h(r)&&!Object.keys(r).length)return!0;if((!s.hungryForWhitespace||s.hungryForWhitespace&&!g(e)&&g(r))&&h(e)&&0!==Object.keys(e).length&&h(r)&&0===Object.keys(r).length||n(e)!==n(r)&&(!s.hungryForWhitespace||s.hungryForWhitespace&&!g(e)))return!1;if("string"==typeof e&&"string"==typeof r)return!!(s.hungryForWhitespace&&g(e)&&g(r))||(s.verboseWhenMismatches?e===r||`Given string ${r} is not matched! We have ${e} on the other end.`:s.useWildcards?m.isMatch(e,r,{caseSensitive:!0}):e===r);if(Array.isArray(e)&&Array.isArray(r)){if(s.hungryForWhitespace&&g(r)&&(!s.matchStrictly||s.matchStrictly&&e.length===r.length))return!0;if(!s.hungryForWhitespace&&r.length>e.length||s.matchStrictly&&r.length!==e.length)return!!s.verboseWhenMismatches&&`The length of a given array, ${JSON.stringify(r,null,4)} is ${r.length} but the length of an array on the other end, ${JSON.stringify(e,null,4)} is ${e.length}`;if(0===r.length)return 0===e.length||!!s.verboseWhenMismatches&&`The given array has no elements, but the array on the other end, ${JSON.stringify(e,null,4)} does have some`;for(let n=0,o=r.length;n<o;n++){c=!1;for(let o=u,i=e.length;o<i;o++)if(u+=1,!0===t(e[o],r[n],s)){c=!0;break}if(!c)return!!s.verboseWhenMismatches&&`The given array ${JSON.stringify(r,null,4)} is not a subset of an array on the other end, ${JSON.stringify(e,null,4)}`}}else{if(!h(e)||!h(r))return!(!(s.hungryForWhitespace&&g(e)&&g(r))||s.matchStrictly&&(!s.matchStrictly||(f=r,h(f)?Object.keys(f).length:!Array.isArray(f)&&"string"!=typeof f||f.length)))||e===r;if(i=new Set(Object.keys(r)),a=new Set(Object.keys(e)),s.matchStrictly&&i.size!==a.size){if(!s.verboseWhenMismatches)return!1;const t=new Set([...i].filter((t=>!a.has(t)))),e=t.size?` First object has unique keys: ${JSON.stringify(t,null,4)}.`:"",r=new Set([...a].filter((t=>!i.has(t))));return`When matching strictly, we found that both objects have different amount of keys.${e}${r.size?` Second object has unique keys:\n ${JSON.stringify(r,null,4)}.`:""}`}for(const o of i){if(!Object.prototype.hasOwnProperty.call(e,o))return!s.useWildcards||s.useWildcards&&!o.includes("*")?!!s.verboseWhenMismatches&&`The given object has key "${o}" which the other-one does not have.`:!!Object.keys(e).some((t=>m.isMatch(t,o,{caseSensitive:!0})))||!!s.verboseWhenMismatches&&`The given object has key "${o}" which the other-one does not have.`;if(null!=e[o]&&n(e[o])!==n(r[o])){if(!(g(e[o])&&g(r[o])&&s.hungryForWhitespace))return!!s.verboseWhenMismatches&&`The given key ${o} is of a different type on both objects. On the first-one, it's ${n(r[o])}, on the second-one, it's ${n(e[o])}`}else if(!0!==t(e[o],r[o],s))return!!s.verboseWhenMismatches&&`The given piece ${JSON.stringify(r[o],null,4)} and ${JSON.stringify(e[o],null,4)} don't match.`}}var f;return!0},Object.defineProperty(t,"__esModule",{value:!0})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ast-compare",
3
- "version": "2.0.16",
3
+ "version": "3.0.2",
4
4
  "description": "Compare anything: AST, objects, arrays, strings and nested thereof",
5
5
  "keywords": [
6
6
  "array",
@@ -33,9 +33,11 @@
33
33
  "email": "roy@codsen.com",
34
34
  "url": "https://codsen.com"
35
35
  },
36
- "main": "dist/ast-compare.cjs.js",
37
- "module": "dist/ast-compare.esm.js",
38
- "browser": "dist/ast-compare.umd.js",
36
+ "type": "module",
37
+ "exports": {
38
+ "script": "./dist/ast-compare.umd.js",
39
+ "default": "./dist/ast-compare.esm.js"
40
+ },
39
41
  "types": "types/index.d.ts",
40
42
  "scripts": {
41
43
  "build": "rollup -c",
@@ -55,18 +57,20 @@
55
57
  "pretest": "npm run build",
56
58
  "test": "npm run lint && npm run unittest && npm run test:examples && npm run clean_cov && npm run format",
57
59
  "test:examples": "../../scripts/test-examples.js && npm run lect && npm run prettier",
58
- "unittest": "./node_modules/.bin/tap --no-only --output-file=testStats.md --reporter=terse && tsc -p tsconfig.json --noEmit && npm run clean_cov && npm run perf",
60
+ "unittest": "tap --no-only --output-file=testStats.md --reporter=terse && tsc -p tsconfig.json --noEmit && npm run clean_cov && npm run perf",
59
61
  "clean_cov": "../../scripts/leaveCoverageTotalOnly.js",
60
62
  "clean_types": "../../scripts/cleanTypes.js"
61
63
  },
62
64
  "tap": {
65
+ "check-coverage": false,
63
66
  "coverage-report": [
64
67
  "json-summary",
65
68
  "text"
66
69
  ],
67
- "nyc-arg": [
68
- "--exclude=**/*.cjs.js",
69
- "--exclude=**/*.umd.js"
70
+ "node-arg": [
71
+ "--no-warnings",
72
+ "--experimental-loader",
73
+ "@istanbuljs/esm-loader-hook"
70
74
  ],
71
75
  "timeout": 0
72
76
  },
@@ -86,50 +90,53 @@
86
90
  }
87
91
  },
88
92
  "dependencies": {
89
- "@babel/runtime": "^7.13.10",
90
- "ast-contains-only-empty-space": "^2.0.16",
93
+ "@babel/runtime": "^7.15.4",
94
+ "ast-contains-only-empty-space": "^3.0.2",
91
95
  "lodash.isplainobject": "^4.0.6",
92
96
  "matcher": "^4.0.0",
93
97
  "type-detect": "^4.0.8"
94
98
  },
95
99
  "devDependencies": {
96
- "@babel/cli": "^7.13.14",
97
- "@babel/core": "^7.13.14",
98
- "@babel/node": "^7.13.13",
99
- "@babel/plugin-external-helpers": "^7.12.13",
100
- "@babel/plugin-proposal-class-properties": "^7.13.0",
101
- "@babel/plugin-proposal-nullish-coalescing-operator": "^7.13.8",
102
- "@babel/plugin-proposal-object-rest-spread": "^7.13.8",
103
- "@babel/plugin-proposal-optional-chaining": "^7.13.12",
104
- "@babel/plugin-transform-runtime": "^7.13.10",
105
- "@babel/preset-env": "^7.13.12",
106
- "@babel/preset-typescript": "^7.13.0",
107
- "@babel/register": "^7.13.14",
100
+ "@babel/cli": "^7.15.4",
101
+ "@babel/core": "^7.15.5",
102
+ "@babel/node": "^7.15.4",
103
+ "@babel/plugin-external-helpers": "^7.14.5",
104
+ "@babel/plugin-proposal-class-properties": "^7.14.5",
105
+ "@babel/plugin-proposal-nullish-coalescing-operator": "^7.14.5",
106
+ "@babel/plugin-proposal-object-rest-spread": "^7.15.6",
107
+ "@babel/plugin-proposal-optional-chaining": "^7.14.5",
108
+ "@babel/plugin-transform-runtime": "^7.15.0",
109
+ "@babel/preset-env": "^7.15.6",
110
+ "@babel/preset-typescript": "^7.15.0",
111
+ "@babel/register": "^7.15.3",
112
+ "@istanbuljs/esm-loader-hook": "^0.1.2",
108
113
  "@rollup/plugin-babel": "^5.3.0",
109
- "@rollup/plugin-commonjs": "^18.0.0",
110
- "@rollup/plugin-node-resolve": "^11.2.1",
111
- "@rollup/plugin-replace": "^2.4.2",
112
- "@rollup/plugin-strip": "^2.0.0",
113
- "@rollup/plugin-typescript": "^8.2.1",
114
+ "@rollup/plugin-commonjs": "^20.0.0",
115
+ "@rollup/plugin-node-resolve": "^13.0.4",
116
+ "@rollup/plugin-strip": "^2.1.0",
117
+ "@rollup/plugin-typescript": "^8.2.5",
114
118
  "@types/lodash.isplainobject": "^4.0.6",
115
- "@types/node": "^14.14.37",
116
- "@types/tap": "^14.10.3",
119
+ "@types/node": "^16.9.1",
120
+ "@types/tap": "^15.0.5",
117
121
  "@types/type-detect": "^4.0.1",
118
- "@typescript-eslint/eslint-plugin": "^4.20.0",
119
- "@typescript-eslint/parser": "^4.20.0",
120
- "core-js": "^3.10.0",
122
+ "@typescript-eslint/eslint-plugin": "^4.31.0",
123
+ "@typescript-eslint/parser": "^4.31.0",
124
+ "core-js": "^3.17.3",
121
125
  "cross-env": "^7.0.3",
122
- "eslint": "^7.23.0",
123
- "lect": "^0.16.16",
124
- "rollup": "^2.44.0",
126
+ "eslint": "^7.32.0",
127
+ "lect": "^0.18.2",
128
+ "rollup": "^2.56.3",
125
129
  "rollup-plugin-ascii": "^0.0.3",
126
130
  "rollup-plugin-banner": "^0.2.1",
127
131
  "rollup-plugin-cleanup": "^3.2.1",
128
- "rollup-plugin-dts": "^3.0.1",
132
+ "rollup-plugin-dts": "^4.0.0",
129
133
  "rollup-plugin-terser": "^7.0.2",
130
- "tap": "^14.11.0",
131
- "tslib": "^2.1.0",
132
- "type-fest": "^1.0.1",
133
- "typescript": "^4.2.3"
134
+ "tap": "^15.0.9",
135
+ "tslib": "^2.3.1",
136
+ "type-fest": "^2.3.2",
137
+ "typescript": "^4.4.3"
138
+ },
139
+ "engines": {
140
+ "node": ">=12"
134
141
  }
135
142
  }
@@ -1,198 +0,0 @@
1
- /**
2
- * @name ast-compare
3
- * @fileoverview Compare anything: AST, objects, arrays, strings and nested thereof
4
- * @version 2.0.16
5
- * @author Roy Revelt, Codsen Ltd
6
- * @license MIT
7
- * {@link https://codsen.com/os/ast-compare/}
8
- */
9
-
10
- 'use strict';
11
-
12
- Object.defineProperty(exports, '__esModule', { value: true });
13
-
14
- var _typeof = require('@babel/runtime/helpers/typeof');
15
- var _createForOfIteratorHelper = require('@babel/runtime/helpers/createForOfIteratorHelper');
16
- var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
17
- var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
18
- var typeDetect = require('type-detect');
19
- var astContainsOnlyEmptySpace = require('ast-contains-only-empty-space');
20
- var isObj = require('lodash.isplainobject');
21
- var matcher = require('matcher');
22
-
23
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
24
-
25
- var _typeof__default = /*#__PURE__*/_interopDefaultLegacy(_typeof);
26
- var _createForOfIteratorHelper__default = /*#__PURE__*/_interopDefaultLegacy(_createForOfIteratorHelper);
27
- var _toConsumableArray__default = /*#__PURE__*/_interopDefaultLegacy(_toConsumableArray);
28
- var _objectSpread__default = /*#__PURE__*/_interopDefaultLegacy(_objectSpread);
29
- var typeDetect__default = /*#__PURE__*/_interopDefaultLegacy(typeDetect);
30
- var isObj__default = /*#__PURE__*/_interopDefaultLegacy(isObj);
31
- var matcher__default = /*#__PURE__*/_interopDefaultLegacy(matcher);
32
-
33
- /* istanbul ignore next */
34
- function isBlank(something) {
35
- if (isObj__default['default'](something)) {
36
- return !Object.keys(something).length;
37
- }
38
- if (Array.isArray(something) || typeof something === "string") {
39
- return !something.length;
40
- }
41
- return false;
42
- }
43
- function compare(b, s, originalOpts) {
44
- var sKeys;
45
- var bKeys;
46
- var found;
47
- var bOffset = 0;
48
- var defaults = {
49
- hungryForWhitespace: false,
50
- matchStrictly: false,
51
- verboseWhenMismatches: false,
52
- useWildcards: false
53
- };
54
- var opts = _objectSpread__default['default'](_objectSpread__default['default']({}, defaults), originalOpts);
55
- if (opts.hungryForWhitespace && opts.matchStrictly && isObj__default['default'](b) && astContainsOnlyEmptySpace.empty(b) && isObj__default['default'](s) && !Object.keys(s).length) {
56
- return true;
57
- }
58
- if ((!opts.hungryForWhitespace || opts.hungryForWhitespace && !astContainsOnlyEmptySpace.empty(b) && astContainsOnlyEmptySpace.empty(s)) && isObj__default['default'](b) && Object.keys(b).length !== 0 && isObj__default['default'](s) && Object.keys(s).length === 0 || typeDetect__default['default'](b) !== typeDetect__default['default'](s) && (!opts.hungryForWhitespace || opts.hungryForWhitespace && !astContainsOnlyEmptySpace.empty(b))) {
59
- return false;
60
- }
61
- if (typeof b === "string" && typeof s === "string") {
62
- if (opts.hungryForWhitespace && astContainsOnlyEmptySpace.empty(b) && astContainsOnlyEmptySpace.empty(s)) {
63
- return true;
64
- }
65
- if (opts.verboseWhenMismatches) {
66
- return b === s ? true : "Given string ".concat(s, " is not matched! We have ").concat(b, " on the other end.");
67
- }
68
- return opts.useWildcards ? matcher__default['default'].isMatch(b, s, {
69
- caseSensitive: true
70
- }) : b === s;
71
- }
72
- if (Array.isArray(b) && Array.isArray(s)) {
73
- if (opts.hungryForWhitespace && astContainsOnlyEmptySpace.empty(s) && (!opts.matchStrictly || opts.matchStrictly && b.length === s.length)) {
74
- return true;
75
- }
76
- if (!opts.hungryForWhitespace && s.length > b.length || opts.matchStrictly && s.length !== b.length) {
77
- if (!opts.verboseWhenMismatches) {
78
- return false;
79
- }
80
- return "The length of a given array, ".concat(JSON.stringify(s, null, 4), " is ").concat(s.length, " but the length of an array on the other end, ").concat(JSON.stringify(b, null, 4), " is ").concat(b.length);
81
- }
82
- if (s.length === 0) {
83
- if (b.length === 0) {
84
- return true;
85
- }
86
- if (opts.verboseWhenMismatches) {
87
- return "The given array has no elements, but the array on the other end, ".concat(JSON.stringify(b, null, 4), " does have some");
88
- }
89
- return false;
90
- }
91
- for (var i = 0, sLen = s.length; i < sLen; i++) {
92
- found = false;
93
- for (var j = bOffset, bLen = b.length; j < bLen; j++) {
94
- bOffset += 1;
95
- if (compare(b[j], s[i], opts) === true) {
96
- found = true;
97
- break;
98
- }
99
- }
100
- if (!found) {
101
- if (!opts.verboseWhenMismatches) {
102
- return false;
103
- }
104
- return "The given array ".concat(JSON.stringify(s, null, 4), " is not a subset of an array on the other end, ").concat(JSON.stringify(b, null, 4));
105
- }
106
- }
107
- } else if (isObj__default['default'](b) && isObj__default['default'](s)) {
108
- sKeys = new Set(Object.keys(s));
109
- bKeys = new Set(Object.keys(b));
110
- if (opts.matchStrictly && sKeys.size !== bKeys.size) {
111
- if (!opts.verboseWhenMismatches) {
112
- return false;
113
- }
114
- var uniqueKeysOnS = new Set(_toConsumableArray__default['default'](sKeys).filter(function (x) {
115
- return !bKeys.has(x);
116
- }));
117
- var sMessage = uniqueKeysOnS.size ? " First object has unique keys: ".concat(JSON.stringify(uniqueKeysOnS, null, 4), ".") : "";
118
- var uniqueKeysOnB = new Set(_toConsumableArray__default['default'](bKeys).filter(function (x) {
119
- return !sKeys.has(x);
120
- }));
121
- var bMessage = uniqueKeysOnB.size ? " Second object has unique keys:\n ".concat(JSON.stringify(uniqueKeysOnB, null, 4), ".") : "";
122
- return "When matching strictly, we found that both objects have different amount of keys.".concat(sMessage).concat(bMessage);
123
- }
124
- var _iterator = _createForOfIteratorHelper__default['default'](sKeys),
125
- _step;
126
- try {
127
- var _loop = function _loop() {
128
- var sKey = _step.value;
129
- if (!Object.prototype.hasOwnProperty.call(b, sKey)) {
130
- if (!opts.useWildcards || opts.useWildcards && !sKey.includes("*")) {
131
- if (!opts.verboseWhenMismatches) {
132
- return {
133
- v: false
134
- };
135
- }
136
- return {
137
- v: "The given object has key \"".concat(sKey, "\" which the other-one does not have.")
138
- };
139
- }
140
- if (Object.keys(b).some(function (bKey) {
141
- return matcher__default['default'].isMatch(bKey, sKey, {
142
- caseSensitive: true
143
- });
144
- })) {
145
- return {
146
- v: true
147
- };
148
- }
149
- if (!opts.verboseWhenMismatches) {
150
- return {
151
- v: false
152
- };
153
- }
154
- return {
155
- v: "The given object has key \"".concat(sKey, "\" which the other-one does not have.")
156
- };
157
- }
158
- if (b[sKey] != null && typeDetect__default['default'](b[sKey]) !== typeDetect__default['default'](s[sKey])) {
159
- if (!(astContainsOnlyEmptySpace.empty(b[sKey]) && astContainsOnlyEmptySpace.empty(s[sKey]) && opts.hungryForWhitespace)) {
160
- if (!opts.verboseWhenMismatches) {
161
- return {
162
- v: false
163
- };
164
- }
165
- return {
166
- v: "The given key ".concat(sKey, " is of a different type on both objects. On the first-one, it's ").concat(typeDetect__default['default'](s[sKey]), ", on the second-one, it's ").concat(typeDetect__default['default'](b[sKey]))
167
- };
168
- }
169
- } else if (compare(b[sKey], s[sKey], opts) !== true) {
170
- if (!opts.verboseWhenMismatches) {
171
- return {
172
- v: false
173
- };
174
- }
175
- return {
176
- v: "The given piece ".concat(JSON.stringify(s[sKey], null, 4), " and ").concat(JSON.stringify(b[sKey], null, 4), " don't match.")
177
- };
178
- }
179
- };
180
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
181
- var _ret = _loop();
182
- if (_typeof__default['default'](_ret) === "object") return _ret.v;
183
- }
184
- } catch (err) {
185
- _iterator.e(err);
186
- } finally {
187
- _iterator.f();
188
- }
189
- } else {
190
- if (opts.hungryForWhitespace && astContainsOnlyEmptySpace.empty(b) && astContainsOnlyEmptySpace.empty(s) && (!opts.matchStrictly || opts.matchStrictly && isBlank(s))) {
191
- return true;
192
- }
193
- return b === s;
194
- }
195
- return true;
196
- }
197
-
198
- exports.compare = compare;