ast-deep-contains 4.0.6 → 4.0.12

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-2021 Roy Revelt and other contributors
3
+ Copyright (c) 2010-2022 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
@@ -26,18 +26,17 @@
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:
29
+ The latest version is **ESM only**: Node 12+ is needed to use it and it must be `import`ed instead of `require`d. If your project is not on ESM yet and you want to use `require`, use an older version of this program, `3.1.0`.
30
30
 
31
31
  ```bash
32
32
  npm i ast-deep-contains
33
33
  ```
34
34
 
35
- If you need a legacy version which works with `require`, use version 3.1.0
36
-
37
35
  ## Quick Take
38
36
 
39
37
  ```js
40
38
  import { strict as assert } from "assert";
39
+
41
40
  import { deepContains } from "ast-deep-contains";
42
41
 
43
42
  const gathered = [];
@@ -84,7 +83,7 @@ assert.equal(errors.length, 0);
84
83
 
85
84
  ## Documentation
86
85
 
87
- Please [visit codsen.com](https://codsen.com/os/ast-deep-contains/) for a full description of the API and examples.
86
+ Please [visit codsen.com](https://codsen.com/os/ast-deep-contains/) for a full description of the API.
88
87
 
89
88
  ## Contributing
90
89
 
@@ -94,6 +93,6 @@ To report bugs or request features or assistance, [raise an issue](https://githu
94
93
 
95
94
  MIT License
96
95
 
97
- Copyright (c) 2010-2021 Roy Revelt and other contributors
96
+ Copyright (c) 2010-2022 Roy Revelt and other contributors
98
97
 
99
98
  <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">
@@ -1,122 +1,15 @@
1
1
  /**
2
2
  * @name ast-deep-contains
3
3
  * @fileoverview Like t.same assert on array of objects, where element order doesn't matter.
4
- * @version 4.0.6
4
+ * @version 4.0.12
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/ast-deep-contains/}
8
8
  */
9
9
 
10
- import objectPath from 'object-path';
11
- import { traverse } from 'ast-monkey-traverse';
12
- import is from '@sindresorhus/is';
13
-
14
- var version$1 = "4.0.6";
15
-
16
- const version = version$1;
17
- function goUp(pathStr) {
18
- if (pathStr.includes(".")) {
19
- for (let i = pathStr.length; i--;) {
20
- if (pathStr[i] === ".") {
21
- return pathStr.slice(0, i);
22
- }
23
- }
24
- }
25
- return pathStr;
26
- }
27
- function dropIth(arr, badIdx) {
28
- return Array.from(arr).filter((_el, i) => i !== badIdx);
29
- }
30
- const defaults = {
31
- skipContainers: true,
32
- arrayStrictComparison: false,
33
- };
34
- function deepContains(tree1, tree2, cb, errCb, originalOpts) {
35
- const opts = { ...defaults, ...originalOpts };
36
- if (is(tree1) !== is(tree2)) {
37
- errCb(`the first input arg is of a type ${is(tree1).toLowerCase()} but the second is ${is(tree2).toLowerCase()}. Values are - 1st:\n${JSON.stringify(tree1, null, 4)}\n2nd:\n${JSON.stringify(tree2, null, 4)}`);
38
- }
39
- else {
40
- traverse(tree2, (key, val, innerObj, stop) => {
41
- const current = val !== undefined ? val : key;
42
- const { path } = innerObj;
43
- if (objectPath.has(tree1, path)) {
44
- if (!opts.arrayStrictComparison &&
45
- is.plainObject(current) &&
46
- innerObj.parentType === "array" &&
47
- innerObj.parent.length > 1) {
48
- stop.now = true;
49
- const arr1 = Array.from(innerObj.path.includes(".")
50
- ? objectPath.get(tree1, goUp(path))
51
- : tree1);
52
- if (arr1.length < innerObj.parent.length) {
53
- errCb(`the first array: ${JSON.stringify(arr1, null, 4)}\nhas less objects than array we're matching against, ${JSON.stringify(innerObj.parent, null, 4)}`);
54
- }
55
- else {
56
- const arr2 = innerObj.parent;
57
- const tree1RefSource = arr1.map((_v, i) => i);
58
- arr2.map((_v, i) => i);
59
- const secondDigits = [];
60
- for (let i = 0, len = tree1RefSource.length; i < len; i++) {
61
- const currArr = [];
62
- const pickedVal = tree1RefSource[i];
63
- const disposableArr1 = dropIth(tree1RefSource, i);
64
- currArr.push(pickedVal);
65
- disposableArr1.forEach((key1) => {
66
- secondDigits.push(Array.from(currArr).concat(key1));
67
- });
68
- }
69
- const finalCombined = secondDigits.map((arr) => {
70
- return arr.map((val2, i) => [i, val2]);
71
- });
72
- let maxScore = 0;
73
- for (let i = 0, len = finalCombined.length; i < len; i++) {
74
- let score = 0;
75
- finalCombined[i].forEach((mapping) => {
76
- if (is.plainObject(arr2[mapping[0]]) &&
77
- is.plainObject(arr1[mapping[1]])) {
78
- Object.keys(arr2[mapping[0]]).forEach((key2) => {
79
- if (Object.keys(arr1[mapping[1]]).includes(key2)) {
80
- score += 1;
81
- if (arr1[mapping[1]][key2] ===
82
- arr2[mapping[0]][key2]) {
83
- score += 5;
84
- }
85
- }
86
- });
87
- }
88
- });
89
- finalCombined[i].push(score);
90
- if (score > maxScore) {
91
- maxScore = score;
92
- }
93
- }
94
- for (let i = 0, len = finalCombined.length; i < len; i++) {
95
- if (finalCombined[i][2] === maxScore) {
96
- finalCombined[i].forEach((matchPairObj, y) => {
97
- if (y < finalCombined[i].length - 1) {
98
- deepContains(arr1[matchPairObj[1]], arr2[matchPairObj[0]], cb, errCb, opts);
99
- }
100
- });
101
- break;
102
- }
103
- }
104
- }
105
- }
106
- else {
107
- const retrieved = objectPath.get(tree1, path);
108
- if (!opts.skipContainers ||
109
- (!is.plainObject(retrieved) && !Array.isArray(retrieved))) {
110
- cb(retrieved, current, path);
111
- }
112
- }
113
- }
114
- else {
115
- errCb(`the first input: ${JSON.stringify(tree1, null, 4)}\ndoes not have the path "${path}", we were looking, would it contain a value ${JSON.stringify(current, null, 0)}.`);
116
- }
117
- return current;
118
- });
119
- }
120
- }
121
-
122
- export { deepContains, defaults, version };
10
+ import h from"object-path";import{traverse as J}from"ast-monkey-traverse";import l from"@sindresorhus/is";var V="4.0.12";var F=V;function j(n){if(n.includes(".")){for(let s=n.length;s--;)if(n[s]===".")return n.slice(0,s)}return n}function k(n,s){return Array.from(n).filter((b,c)=>c!==s)}var w={skipContainers:!0,arrayStrictComparison:!1};function x(n,s,b,c,D){let f={...w,...D};l(n)!==l(s)?c(`the first input arg is of a type ${l(n).toLowerCase()} but the second is ${l(s).toLowerCase()}. Values are - 1st:
11
+ ${JSON.stringify(n,null,4)}
12
+ 2nd:
13
+ ${JSON.stringify(s,null,4)}`):J(s,(O,E,a,N)=>{let d=E!==void 0?E:O,{path:$}=a;if(h.has(n,$))if(!f.arrayStrictComparison&&l.plainObject(d)&&a.parentType==="array"&&a.parent.length>1){N.now=!0;let o=Array.from(a.path.includes(".")?h.get(n,j($)):n);if(o.length<a.parent.length)c(`the first array: ${JSON.stringify(o,null,4)}
14
+ has less objects than array we're matching against, ${JSON.stringify(a.parent,null,4)}`);else{let m=a.parent,g=o.map((e,t)=>t),A=m.map((e,t)=>t),S=[];for(let e=0,t=g.length;e<t;e++){let r=[],i=g[e],p=k(g,e);r.push(i),p.forEach(v=>{S.push(Array.from(r).concat(v))})}let u=S.map(e=>e.map((t,r)=>[r,t])),y=0;for(let e=0,t=u.length;e<t;e++){let r=0;u[e].forEach(i=>{l.plainObject(m[i[0]])&&l.plainObject(o[i[1]])&&Object.keys(m[i[0]]).forEach(p=>{Object.keys(o[i[1]]).includes(p)&&(r+=1,o[i[1]][p]===m[i[0]][p]&&(r+=5))})}),u[e].push(r),r>y&&(y=r)}for(let e=0,t=u.length;e<t;e++)if(u[e][2]===y){u[e].forEach((r,i)=>{i<u[e].length-1&&x(o[r[1]],m[r[0]],b,c,f)});break}}}else{let o=h.get(n,$);(!f.skipContainers||!l.plainObject(o)&&!Array.isArray(o))&&b(o,d,$)}else c(`the first input: ${JSON.stringify(n,null,4)}
15
+ does not have the path "${$}", we were looking, would it contain a value ${JSON.stringify(d,null,0)}.`);return d})}export{x as deepContains,w as defaults,F as version};
@@ -1,26 +1,31 @@
1
1
  /**
2
2
  * @name ast-deep-contains
3
3
  * @fileoverview Like t.same assert on array of objects, where element order doesn't matter.
4
- * @version 4.0.6
4
+ * @version 4.0.12
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/ast-deep-contains/}
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).astDeepContains={})}(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){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var n={exports:{}};!function(t){t.exports=function(){var t=Object.prototype.toString;function e(t,e){return null!=t&&Object.prototype.hasOwnProperty.call(t,e)}function r(t){if(!t)return!0;if(o(t)&&0===t.length)return!0;if("string"!=typeof t){for(var r in t)if(e(t,r))return!1;return!0}return!1}function n(e){return t.call(e)}function a(t){return"object"==typeof t&&"[object Object]"===n(t)}var o=Array.isArray||function(e){return"[object Array]"===t.call(e)};function i(t){return"boolean"==typeof t||"[object Boolean]"===n(t)}function u(t){var e=parseInt(t);return e.toString()===t?e:t}function c(t){var n,c,s=function(t){return Object.keys(s).reduce((function(e,r){return"create"===r||"function"==typeof s[r]&&(e[r]=s[r].bind(s,t)),e}),{})};function l(t,e){if(n(t,e))return t[e]}function f(t,e,r,n){if("number"==typeof e&&(e=[e]),!e||0===e.length)return t;if("string"==typeof e)return f(t,e.split(".").map(u),r,n);var a=e[0],o=c(t,a);return 1===e.length?(void 0!==o&&n||(t[a]=r),o):(void 0===o&&(t[a]="number"==typeof e[1]?[]:{}),f(t[a],e.slice(1),r,n))}return n=(t=t||{}).includeInheritedProps?function(){return!0}:function(t,r){return"number"==typeof r&&Array.isArray(t)||e(t,r)},c=t.includeInheritedProps?function(t,e){"string"!=typeof e&&"number"!=typeof e&&(e=String(e));var r=l(t,e);if("__proto__"===e||"prototype"===e||"constructor"===e&&"function"==typeof r)throw new Error("For security reasons, object's magic properties cannot be set");return r}:function(t,e){return l(t,e)},s.has=function(r,n){if("number"==typeof n?n=[n]:"string"==typeof n&&(n=n.split(".")),!n||0===n.length)return!!r;for(var a=0;a<n.length;a++){var i=u(n[a]);if(!("number"==typeof i&&o(r)&&i<r.length||(t.includeInheritedProps?i in Object(r):e(r,i))))return!1;r=r[i]}return!0},s.ensureExists=function(t,e,r){return f(t,e,r,!0)},s.set=function(t,e,r,n){return f(t,e,r,n)},s.insert=function(t,e,r,n){var a=s.get(t,e);n=~~n,o(a)||s.set(t,e,a=[]),a.splice(n,0,r)},s.empty=function(t,e){var u,c;if(!r(e)&&null!=t&&(u=s.get(t,e))){if("string"==typeof u)return s.set(t,e,"");if(i(u))return s.set(t,e,!1);if("number"==typeof u)return s.set(t,e,0);if(o(u))u.length=0;else{if(!a(u))return s.set(t,e,null);for(c in u)n(u,c)&&delete u[c]}}},s.push=function(t,e){var r=s.get(t,e);o(r)||s.set(t,e,r=[]),r.push.apply(r,Array.prototype.slice.call(arguments,2))},s.coalesce=function(t,e,r){for(var n,a=0,o=e.length;a<o;a++)if(void 0!==(n=s.get(t,e[a])))return n;return r},s.get=function(t,e,r){if("number"==typeof e&&(e=[e]),!e||0===e.length)return t;if(null==t)return r;if("string"==typeof e)return s.get(t,e.split("."),r);var n=u(e[0]),a=c(t,n);return void 0===a?r:1===e.length?a:s.get(t[n],e.slice(1),r)},s.del=function(t,e){if("number"==typeof e&&(e=[e]),null==t)return t;if(r(e))return t;if("string"==typeof e)return s.del(t,e.split("."));var a=u(e[0]);return c(t,a),n(t,a)?1!==e.length?s.del(t[a],e.slice(1)):(o(t)?t.splice(a,1):delete t[a],t):t},s}var s=c();return s.create=c,s.withInheritedProps=c({includeInheritedProps:!0}),s}()}(n);var a=n.exports,o={exports:{}};!function(t,r){var n="__lodash_hash_undefined__",a=9007199254740991,o="[object Arguments]",i="[object Boolean]",u="[object Date]",c="[object Function]",s="[object GeneratorFunction]",l="[object Map]",f="[object Number]",y="[object Object]",p="[object Promise]",b="[object RegExp]",d="[object Set]",g="[object String]",h="[object Symbol]",m="[object WeakMap]",v="[object ArrayBuffer]",_="[object DataView]",A="[object Float32Array]",j="[object Float64Array]",O="[object Int8Array]",w="[object Int16Array]",S="[object Int32Array]",I="[object Uint8Array]",E="[object Uint8ClampedArray]",F="[object Uint16Array]",P="[object Uint32Array]",x=/\w*$/,U=/^\[object .+?Constructor\]$/,M=/^(?:0|[1-9]\d*)$/,k={};k[o]=k["[object Array]"]=k[v]=k[_]=k[i]=k[u]=k[A]=k[j]=k[O]=k[w]=k[S]=k[l]=k[f]=k[y]=k[b]=k[d]=k[g]=k[h]=k[I]=k[E]=k[F]=k[P]=!0,k["[object Error]"]=k[c]=k[m]=!1;var B="object"==typeof self&&self&&self.Object===Object&&self,N="object"==typeof e&&e&&e.Object===Object&&e||B||Function("return this")(),$=r&&!r.nodeType&&r,T=$&&t&&!t.nodeType&&t,L=T&&T.exports===$;function C(t,e){return t.set(e[0],e[1]),t}function D(t,e){return t.add(e),t}function G(t,e,r,n){var a=-1,o=t?t.length:0;for(n&&o&&(r=t[++a]);++a<o;)r=e(r,t[a],a,t);return r}function R(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function V(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}function W(t,e){return function(r){return t(e(r))}}function J(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}var K,z=Array.prototype,H=Function.prototype,q=Object.prototype,Q=N["__core-js_shared__"],X=(K=/[^.]+$/.exec(Q&&Q.keys&&Q.keys.IE_PROTO||""))?"Symbol(src)_1."+K:"",Y=H.toString,Z=q.hasOwnProperty,tt=q.toString,et=RegExp("^"+Y.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),rt=L?N.Buffer:void 0,nt=N.Symbol,at=N.Uint8Array,ot=W(Object.getPrototypeOf,Object),it=Object.create,ut=q.propertyIsEnumerable,ct=z.splice,st=Object.getOwnPropertySymbols,lt=rt?rt.isBuffer:void 0,ft=W(Object.keys,Object),yt=Tt(N,"DataView"),pt=Tt(N,"Map"),bt=Tt(N,"Promise"),dt=Tt(N,"Set"),gt=Tt(N,"WeakMap"),ht=Tt(Object,"create"),mt=Rt(yt),vt=Rt(pt),_t=Rt(bt),At=Rt(dt),jt=Rt(gt),Ot=nt?nt.prototype:void 0,wt=Ot?Ot.valueOf:void 0;function St(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 It(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 Et(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 Ft(t){this.__data__=new It(t)}function Pt(t,e){var r=Wt(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&Jt(t)}(t)&&Z.call(t,"callee")&&(!ut.call(t,"callee")||tt.call(t)==o)}(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,a=!!n;for(var i in t)!e&&!Z.call(t,i)||a&&("length"==i||Dt(i,n))||r.push(i);return r}function xt(t,e,r){var n=t[e];Z.call(t,e)&&Vt(n,r)&&(void 0!==r||e in t)||(t[e]=r)}function Ut(t,e){for(var r=t.length;r--;)if(Vt(t[r][0],e))return r;return-1}function Mt(t,e,r,n,a,p,m){var U;if(n&&(U=p?n(t,a,p,m):n(t)),void 0!==U)return U;if(!Ht(t))return t;var M=Wt(t);if(M){if(U=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,U)}else{var B=Ct(t),N=B==c||B==s;if(Kt(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(B==y||B==o||N&&!p){if(R(t))return p?t:{};if(U=function(t){return"function"!=typeof t.constructor||Gt(t)?{}:(e=ot(t),Ht(e)?it(e):{});var e}(N?{}:t),!e)return function(t,e){return Nt(t,Lt(t),e)}(t,function(t,e){return t&&Nt(e,qt(e),t)}(U,t))}else{if(!k[B])return p?t:{};U=function(t,e,r,n){var a=t.constructor;switch(e){case v:return Bt(t);case i:case u:return new a(+t);case _:return function(t,e){var r=e?Bt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,n);case A:case j:case O:case w:case S:case I:case E:case F:case P:return function(t,e){var r=e?Bt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}(t,n);case l:return function(t,e,r){return G(e?r(V(t),!0):V(t),C,new t.constructor)}(t,n,r);case f:case g:return new a(t);case b: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 G(e?r(J(t),!0):J(t),D,new t.constructor)}(t,n,r);case h:return o=t,wt?Object(wt.call(o)):{}}var o}(t,B,Mt,e)}}m||(m=new Ft);var $=m.get(t);if($)return $;if(m.set(t,U),!M)var T=r?function(t){return function(t,e,r){var n=e(t);return Wt(t)?n:function(t,e){for(var r=-1,n=e.length,a=t.length;++r<n;)t[a+r]=e[r];return t}(n,r(t))}(t,qt,Lt)}(t):qt(t);return function(t,e){for(var r=-1,n=t?t.length:0;++r<n&&!1!==e(t[r],r,t););}(T||t,(function(a,o){T&&(a=t[o=a]),xt(U,o,Mt(a,e,r,n,o,t,m))})),U}function kt(t){return!(!Ht(t)||(e=t,X&&X in e))&&(zt(t)||R(t)?et:U).test(Rt(t));var e}function Bt(t){var e=new t.constructor(t.byteLength);return new at(e).set(new at(t)),e}function Nt(t,e,r,n){r||(r={});for(var a=-1,o=e.length;++a<o;){var i=e[a],u=n?n(r[i],t[i],i,r,t):void 0;xt(r,i,void 0===u?t[i]:u)}return r}function $t(t,e){var r,n,a=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?a["string"==typeof e?"string":"hash"]:a.map}function Tt(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return kt(r)?r:void 0}St.prototype.clear=function(){this.__data__=ht?ht(null):{}},St.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},St.prototype.get=function(t){var e=this.__data__;if(ht){var r=e[t];return r===n?void 0:r}return Z.call(e,t)?e[t]:void 0},St.prototype.has=function(t){var e=this.__data__;return ht?void 0!==e[t]:Z.call(e,t)},St.prototype.set=function(t,e){return this.__data__[t]=ht&&void 0===e?n:e,this},It.prototype.clear=function(){this.__data__=[]},It.prototype.delete=function(t){var e=this.__data__,r=Ut(e,t);return!(r<0)&&(r==e.length-1?e.pop():ct.call(e,r,1),!0)},It.prototype.get=function(t){var e=this.__data__,r=Ut(e,t);return r<0?void 0:e[r][1]},It.prototype.has=function(t){return Ut(this.__data__,t)>-1},It.prototype.set=function(t,e){var r=this.__data__,n=Ut(r,t);return n<0?r.push([t,e]):r[n][1]=e,this},Et.prototype.clear=function(){this.__data__={hash:new St,map:new(pt||It),string:new St}},Et.prototype.delete=function(t){return $t(this,t).delete(t)},Et.prototype.get=function(t){return $t(this,t).get(t)},Et.prototype.has=function(t){return $t(this,t).has(t)},Et.prototype.set=function(t,e){return $t(this,t).set(t,e),this},Ft.prototype.clear=function(){this.__data__=new It},Ft.prototype.delete=function(t){return this.__data__.delete(t)},Ft.prototype.get=function(t){return this.__data__.get(t)},Ft.prototype.has=function(t){return this.__data__.has(t)},Ft.prototype.set=function(t,e){var r=this.__data__;if(r instanceof It){var n=r.__data__;if(!pt||n.length<199)return n.push([t,e]),this;r=this.__data__=new Et(n)}return r.set(t,e),this};var Lt=st?W(st,Object):function(){return[]},Ct=function(t){return tt.call(t)};function Dt(t,e){return!!(e=null==e?a:e)&&("number"==typeof t||M.test(t))&&t>-1&&t%1==0&&t<e}function Gt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||q)}function Rt(t){if(null!=t){try{return Y.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Vt(t,e){return t===e||t!=t&&e!=e}(yt&&Ct(new yt(new ArrayBuffer(1)))!=_||pt&&Ct(new pt)!=l||bt&&Ct(bt.resolve())!=p||dt&&Ct(new dt)!=d||gt&&Ct(new gt)!=m)&&(Ct=function(t){var e=tt.call(t),r=e==y?t.constructor:void 0,n=r?Rt(r):void 0;if(n)switch(n){case mt:return _;case vt:return l;case _t:return p;case At:return d;case jt:return m}return e});var Wt=Array.isArray;function Jt(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=a}(t.length)&&!zt(t)}var Kt=lt||function(){return!1};function zt(t){var e=Ht(t)?tt.call(t):"";return e==c||e==s}function Ht(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function qt(t){return Jt(t)?Pt(t):function(t){if(!Gt(t))return ft(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 Mt(t,!0,!0)}}(o,o.exports);var i=o.exports;var u,c,s=Object.prototype,l=Function.prototype.toString,f=s.hasOwnProperty,y=l.call(Object),p=s.toString,b=(u=Object.getPrototypeOf,c=Object,function(t){return u(c(t))});var d=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=b(t);if(null===e)return!0;var r=f.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&l.call(r)==y};
11
- /**
12
- * @name ast-monkey-util
13
- * @fileoverview Utility library of AST helper functions
14
- * @version 2.0.6
15
- * @author Roy Revelt, Codsen Ltd
16
- * @license MIT
17
- * {@link https://codsen.com/os/ast-monkey-util/}
18
- */function g(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}
10
+ var astDeepContains=(()=>{var Dr=Object.create;var G=Object.defineProperty,Vr=Object.defineProperties,Fr=Object.getOwnPropertyDescriptor,Mr=Object.getOwnPropertyDescriptors,Ur=Object.getOwnPropertyNames,Ot=Object.getOwnPropertySymbols,vr=Object.getPrototypeOf,Et=Object.prototype.hasOwnProperty,Br=Object.prototype.propertyIsEnumerable;var wt=(t,r,n)=>r in t?G(t,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[r]=n,I=(t,r)=>{for(var n in r||(r={}))Et.call(r,n)&&wt(t,n,r[n]);if(Ot)for(var n of Ot(r))Br.call(r,n)&&wt(t,n,r[n]);return t},L=(t,r)=>Vr(t,Mr(r)),It=t=>G(t,"__esModule",{value:!0});var z=(t,r)=>()=>(r||t((r={exports:{}}).exports,r),r.exports),kr=(t,r)=>{for(var n in r)G(t,n,{get:r[n],enumerable:!0})},Tt=(t,r,n,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let y of Ur(r))!Et.call(t,y)&&(n||y!=="default")&&G(t,y,{get:()=>r[y],enumerable:!(o=Fr(r,y))||o.enumerable});return t},X=(t,r)=>Tt(It(G(t!=null?Dr(vr(t)):{},"default",!r&&t&&t.__esModule?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t),Rr=(t=>(r,n)=>t&&t.get(r)||(n=Tt(It({}),r,1),t&&t.set(r,n),n))(typeof WeakMap!="undefined"?new WeakMap:0);var Ct=z((jt,Y)=>{(function(t,r){"use strict";typeof Y=="object"&&typeof Y.exports=="object"?Y.exports=r():typeof define=="function"&&define.amd?define([],r):t.objectPath=r()})(jt,function(){"use strict";var t=Object.prototype.toString;function r(f,s){return f==null?!1:Object.prototype.hasOwnProperty.call(f,s)}function n(f){if(!f||p(f)&&f.length===0)return!0;if(typeof f!="string"){for(var s in f)if(r(f,s))return!1;return!0}return!1}function o(f){return t.call(f)}function y(f){return typeof f=="object"&&o(f)==="[object Object]"}var p=Array.isArray||function(f){return t.call(f)==="[object Array]"};function _(f){return typeof f=="boolean"||o(f)==="[object Boolean]"}function m(f){var s=parseInt(f);return s.toString()===f?s:f}function d(f){f=f||{};var s=function(u){return Object.keys(s).reduce(function(i,c){return c==="create"||typeof s[c]=="function"&&(i[c]=s[c].bind(s,u)),i},{})},b;f.includeInheritedProps?b=function(){return!0}:b=function(u,i){return typeof i=="number"&&Array.isArray(u)||r(u,i)};function O(u,i){if(b(u,i))return u[i]}var E;f.includeInheritedProps?E=function(u,i){typeof i!="string"&&typeof i!="number"&&(i=String(i));var c=O(u,i);if(i==="__proto__"||i==="prototype"||i==="constructor"&&typeof c=="function")throw new Error("For security reasons, object's magic properties cannot be set");return c}:E=function(u,i){return O(u,i)};function k(u,i,c,l){if(typeof i=="number"&&(i=[i]),!i||i.length===0)return u;if(typeof i=="string")return k(u,i.split(".").map(m),c,l);var g=i[0],$=E(u,g);return i.length===1?(($===void 0||!l)&&(u[g]=c),$):($===void 0&&(typeof i[1]=="number"?u[g]=[]:u[g]={}),k(u[g],i.slice(1),c,l))}return s.has=function(u,i){if(typeof i=="number"?i=[i]:typeof i=="string"&&(i=i.split(".")),!i||i.length===0)return!!u;for(var c=0;c<i.length;c++){var l=m(i[c]);if(typeof l=="number"&&p(u)&&l<u.length||(f.includeInheritedProps?l in Object(u):r(u,l)))u=u[l];else return!1}return!0},s.ensureExists=function(u,i,c){return k(u,i,c,!0)},s.set=function(u,i,c,l){return k(u,i,c,l)},s.insert=function(u,i,c,l){var g=s.get(u,i);l=~~l,p(g)||(g=[],s.set(u,i,g)),g.splice(l,0,c)},s.empty=function(u,i){if(!n(i)&&u!=null){var c,l;if(!!(c=s.get(u,i))){if(typeof c=="string")return s.set(u,i,"");if(_(c))return s.set(u,i,!1);if(typeof c=="number")return s.set(u,i,0);if(p(c))c.length=0;else if(y(c))for(l in c)b(c,l)&&delete c[l];else return s.set(u,i,null)}}},s.push=function(u,i){var c=s.get(u,i);p(c)||(c=[],s.set(u,i,c)),c.push.apply(c,Array.prototype.slice.call(arguments,2))},s.coalesce=function(u,i,c){for(var l,g=0,$=i.length;g<$;g++)if((l=s.get(u,i[g]))!==void 0)return l;return c},s.get=function(u,i,c){if(typeof i=="number"&&(i=[i]),!i||i.length===0)return u;if(u==null)return c;if(typeof i=="string")return s.get(u,i.split("."),c);var l=m(i[0]),g=E(u,l);return g===void 0?c:i.length===1?g:s.get(u[l],i.slice(1),c)},s.del=function(i,c){if(typeof c=="number"&&(c=[c]),i==null||n(c))return i;if(typeof c=="string")return s.del(i,c.split("."));var l=m(c[0]);if(E(i,l),!b(i,l))return i;if(c.length===1)p(i)?i.splice(l,1):delete i[l];else return s.del(i[l],c.slice(1));return i},s}var S=d();return S.create=d,S.withInheritedProps=d({includeInheritedProps:!0}),S})});var br=z((K,v)=>{var Gr=200,xt="__lodash_hash_undefined__",Nt=9007199254740991,ct="[object Arguments]",Lr="[object Array]",Pt="[object Boolean]",Dt="[object Date]",Jr="[object Error]",ut="[object Function]",Vt="[object GeneratorFunction]",q="[object Map]",Ft="[object Number]",ft="[object Object]",Mt="[object Promise]",Ut="[object RegExp]",Z="[object Set]",vt="[object String]",Bt="[object Symbol]",lt="[object WeakMap]",kt="[object ArrayBuffer]",Q="[object DataView]",Rt="[object Float32Array]",Gt="[object Float64Array]",Lt="[object Int8Array]",Jt="[object Int16Array]",Ht="[object Int32Array]",Kt="[object Uint8Array]",Wt="[object Uint8ClampedArray]",zt="[object Uint16Array]",Xt="[object Uint32Array]",Hr=/[\\^$.*+?()[\]{}|]/g,Kr=/\w*$/,Wr=/^\[object .+?Constructor\]$/,zr=/^(?:0|[1-9]\d*)$/,h={};h[ct]=h[Lr]=h[kt]=h[Q]=h[Pt]=h[Dt]=h[Rt]=h[Gt]=h[Lt]=h[Jt]=h[Ht]=h[q]=h[Ft]=h[ft]=h[Ut]=h[Z]=h[vt]=h[Bt]=h[Kt]=h[Wt]=h[zt]=h[Xt]=!0;h[Jr]=h[ut]=h[lt]=!1;var Xr=typeof global=="object"&&global&&global.Object===Object&&global,Yr=typeof self=="object"&&self&&self.Object===Object&&self,T=Xr||Yr||Function("return this")(),Yt=typeof K=="object"&&K&&!K.nodeType&&K,qt=Yt&&typeof v=="object"&&v&&!v.nodeType&&v,qr=qt&&qt.exports===Yt;function Zr(t,r){return t.set(r[0],r[1]),t}function Qr(t,r){return t.add(r),t}function te(t,r){for(var n=-1,o=t?t.length:0;++n<o&&r(t[n],n,t)!==!1;);return t}function re(t,r){for(var n=-1,o=r.length,y=t.length;++n<o;)t[y+n]=r[n];return t}function Zt(t,r,n,o){var y=-1,p=t?t.length:0;for(o&&p&&(n=t[++y]);++y<p;)n=r(n,t[y],y,t);return n}function ee(t,r){for(var n=-1,o=Array(t);++n<t;)o[n]=r(n);return o}function ne(t,r){return t==null?void 0:t[r]}function Qt(t){var r=!1;if(t!=null&&typeof t.toString!="function")try{r=!!(t+"")}catch(n){}return r}function tr(t){var r=-1,n=Array(t.size);return t.forEach(function(o,y){n[++r]=[y,o]}),n}function yt(t,r){return function(n){return t(r(n))}}function rr(t){var r=-1,n=Array(t.size);return t.forEach(function(o){n[++r]=o}),n}var ie=Array.prototype,oe=Function.prototype,tt=Object.prototype,pt=T["__core-js_shared__"],er=function(){var t=/[^.]+$/.exec(pt&&pt.keys&&pt.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),nr=oe.toString,N=tt.hasOwnProperty,rt=tt.toString,ae=RegExp("^"+nr.call(N).replace(Hr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ir=qr?T.Buffer:void 0,or=T.Symbol,ar=T.Uint8Array,se=yt(Object.getPrototypeOf,Object),ce=Object.create,ue=tt.propertyIsEnumerable,fe=ie.splice,sr=Object.getOwnPropertySymbols,le=ir?ir.isBuffer:void 0,ye=yt(Object.keys,Object),dt=U(T,"DataView"),J=U(T,"Map"),gt=U(T,"Promise"),mt=U(T,"Set"),bt=U(T,"WeakMap"),H=U(Object,"create"),pe=V(dt),de=V(J),ge=V(gt),me=V(mt),be=V(bt),cr=or?or.prototype:void 0,ur=cr?cr.valueOf:void 0;function P(t){var r=-1,n=t?t.length:0;for(this.clear();++r<n;){var o=t[r];this.set(o[0],o[1])}}function he(){this.__data__=H?H(null):{}}function Ae(t){return this.has(t)&&delete this.__data__[t]}function $e(t){var r=this.__data__;if(H){var n=r[t];return n===xt?void 0:n}return N.call(r,t)?r[t]:void 0}function _e(t){var r=this.__data__;return H?r[t]!==void 0:N.call(r,t)}function Se(t,r){var n=this.__data__;return n[t]=H&&r===void 0?xt:r,this}P.prototype.clear=he;P.prototype.delete=Ae;P.prototype.get=$e;P.prototype.has=_e;P.prototype.set=Se;function j(t){var r=-1,n=t?t.length:0;for(this.clear();++r<n;){var o=t[r];this.set(o[0],o[1])}}function Oe(){this.__data__=[]}function Ee(t){var r=this.__data__,n=et(r,t);if(n<0)return!1;var o=r.length-1;return n==o?r.pop():fe.call(r,n,1),!0}function we(t){var r=this.__data__,n=et(r,t);return n<0?void 0:r[n][1]}function Ie(t){return et(this.__data__,t)>-1}function Te(t,r){var n=this.__data__,o=et(n,t);return o<0?n.push([t,r]):n[o][1]=r,this}j.prototype.clear=Oe;j.prototype.delete=Ee;j.prototype.get=we;j.prototype.has=Ie;j.prototype.set=Te;function F(t){var r=-1,n=t?t.length:0;for(this.clear();++r<n;){var o=t[r];this.set(o[0],o[1])}}function je(){this.__data__={hash:new P,map:new(J||j),string:new P}}function Ce(t){return nt(this,t).delete(t)}function xe(t){return nt(this,t).get(t)}function Ne(t){return nt(this,t).has(t)}function Pe(t,r){return nt(this,t).set(t,r),this}F.prototype.clear=je;F.prototype.delete=Ce;F.prototype.get=xe;F.prototype.has=Ne;F.prototype.set=Pe;function M(t){this.__data__=new j(t)}function De(){this.__data__=new j}function Ve(t){return this.__data__.delete(t)}function Fe(t){return this.__data__.get(t)}function Me(t){return this.__data__.has(t)}function Ue(t,r){var n=this.__data__;if(n instanceof j){var o=n.__data__;if(!J||o.length<Gr-1)return o.push([t,r]),this;n=this.__data__=new F(o)}return n.set(t,r),this}M.prototype.clear=De;M.prototype.delete=Ve;M.prototype.get=Fe;M.prototype.has=Me;M.prototype.set=Ue;function ve(t,r){var n=$t(t)||un(t)?ee(t.length,String):[],o=n.length,y=!!o;for(var p in t)(r||N.call(t,p))&&!(y&&(p=="length"||on(p,o)))&&n.push(p);return n}function fr(t,r,n){var o=t[r];(!(N.call(t,r)&&dr(o,n))||n===void 0&&!(r in t))&&(t[r]=n)}function et(t,r){for(var n=t.length;n--;)if(dr(t[n][0],r))return n;return-1}function Be(t,r){return t&&lr(r,_t(r),t)}function ht(t,r,n,o,y,p,_){var m;if(o&&(m=p?o(t,y,p,_):o(t)),m!==void 0)return m;if(!it(t))return t;var d=$t(t);if(d){if(m=rn(t),!r)return Ze(t,m)}else{var S=D(t),f=S==ut||S==Vt;if(ln(t))return He(t,r);if(S==ft||S==ct||f&&!p){if(Qt(t))return p?t:{};if(m=en(f?{}:t),!r)return Qe(t,Be(m,t))}else{if(!h[S])return p?t:{};m=nn(t,S,ht,r)}}_||(_=new M);var s=_.get(t);if(s)return s;if(_.set(t,m),!d)var b=n?tn(t):_t(t);return te(b||t,function(O,E){b&&(E=O,O=t[E]),fr(m,E,ht(O,r,n,o,E,t,_))}),m}function ke(t){return it(t)?ce(t):{}}function Re(t,r,n){var o=r(t);return $t(t)?o:re(o,n(t))}function Ge(t){return rt.call(t)}function Le(t){if(!it(t)||sn(t))return!1;var r=mr(t)||Qt(t)?ae:Wr;return r.test(V(t))}function Je(t){if(!pr(t))return ye(t);var r=[];for(var n in Object(t))N.call(t,n)&&n!="constructor"&&r.push(n);return r}function He(t,r){if(r)return t.slice();var n=new t.constructor(t.length);return t.copy(n),n}function At(t){var r=new t.constructor(t.byteLength);return new ar(r).set(new ar(t)),r}function Ke(t,r){var n=r?At(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}function We(t,r,n){var o=r?n(tr(t),!0):tr(t);return Zt(o,Zr,new t.constructor)}function ze(t){var r=new t.constructor(t.source,Kr.exec(t));return r.lastIndex=t.lastIndex,r}function Xe(t,r,n){var o=r?n(rr(t),!0):rr(t);return Zt(o,Qr,new t.constructor)}function Ye(t){return ur?Object(ur.call(t)):{}}function qe(t,r){var n=r?At(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function Ze(t,r){var n=-1,o=t.length;for(r||(r=Array(o));++n<o;)r[n]=t[n];return r}function lr(t,r,n,o){n||(n={});for(var y=-1,p=r.length;++y<p;){var _=r[y],m=o?o(n[_],t[_],_,n,t):void 0;fr(n,_,m===void 0?t[_]:m)}return n}function Qe(t,r){return lr(t,yr(t),r)}function tn(t){return Re(t,_t,yr)}function nt(t,r){var n=t.__data__;return an(r)?n[typeof r=="string"?"string":"hash"]:n.map}function U(t,r){var n=ne(t,r);return Le(n)?n:void 0}var yr=sr?yt(sr,Object):dn,D=Ge;(dt&&D(new dt(new ArrayBuffer(1)))!=Q||J&&D(new J)!=q||gt&&D(gt.resolve())!=Mt||mt&&D(new mt)!=Z||bt&&D(new bt)!=lt)&&(D=function(t){var r=rt.call(t),n=r==ft?t.constructor:void 0,o=n?V(n):void 0;if(o)switch(o){case pe:return Q;case de:return q;case ge:return Mt;case me:return Z;case be:return lt}return r});function rn(t){var r=t.length,n=t.constructor(r);return r&&typeof t[0]=="string"&&N.call(t,"index")&&(n.index=t.index,n.input=t.input),n}function en(t){return typeof t.constructor=="function"&&!pr(t)?ke(se(t)):{}}function nn(t,r,n,o){var y=t.constructor;switch(r){case kt:return At(t);case Pt:case Dt:return new y(+t);case Q:return Ke(t,o);case Rt:case Gt:case Lt:case Jt:case Ht:case Kt:case Wt:case zt:case Xt:return qe(t,o);case q:return We(t,o,n);case Ft:case vt:return new y(t);case Ut:return ze(t);case Z:return Xe(t,o,n);case Bt:return Ye(t)}}function on(t,r){return r=r==null?Nt:r,!!r&&(typeof t=="number"||zr.test(t))&&t>-1&&t%1==0&&t<r}function an(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}function sn(t){return!!er&&er in t}function pr(t){var r=t&&t.constructor,n=typeof r=="function"&&r.prototype||tt;return t===n}function V(t){if(t!=null){try{return nr.call(t)}catch(r){}try{return t+""}catch(r){}}return""}function cn(t){return ht(t,!0,!0)}function dr(t,r){return t===r||t!==t&&r!==r}function un(t){return fn(t)&&N.call(t,"callee")&&(!ue.call(t,"callee")||rt.call(t)==ct)}var $t=Array.isArray;function gr(t){return t!=null&&yn(t.length)&&!mr(t)}function fn(t){return pn(t)&&gr(t)}var ln=le||gn;function mr(t){var r=it(t)?rt.call(t):"";return r==ut||r==Vt}function yn(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Nt}function it(t){var r=typeof t;return!!t&&(r=="object"||r=="function")}function pn(t){return!!t&&typeof t=="object"}function _t(t){return gr(t)?ve(t):Je(t)}function dn(){return[]}function gn(){return!1}v.exports=cn});var _r=z((Jn,$r)=>{var mn="[object Object]";function bn(t){var r=!1;if(t!=null&&typeof t.toString!="function")try{r=!!(t+"")}catch(n){}return r}function hn(t,r){return function(n){return t(r(n))}}var An=Function.prototype,hr=Object.prototype,Ar=An.toString,$n=hr.hasOwnProperty,_n=Ar.call(Object),Sn=hr.toString,On=hn(Object.getPrototypeOf,Object);function En(t){return!!t&&typeof t=="object"}function wn(t){if(!En(t)||Sn.call(t)!=mn||bn(t))return!1;var r=On(t);if(r===null)return!0;var n=$n.call(r,"constructor")&&r.constructor;return typeof n=="function"&&n instanceof n&&Ar.call(n)==_n}$r.exports=wn});var jr=z((C,at)=>{"use strict";Object.defineProperty(C,"__esModule",{value:!0});var Er=["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function Tn(t){return Er.includes(t)}var jn=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","FormData","URLSearchParams","HTMLElement",...Er];function Cn(t){return jn.includes(t)}var xn=["null","undefined","string","number","bigint","boolean","symbol"];function Nn(t){return xn.includes(t)}function B(t){return r=>typeof r===t}var{toString:wr}=Object.prototype,W=t=>{let r=wr.call(t).slice(8,-1);if(/HTML\w+Element/.test(r)&&e.domElement(t))return"HTMLElement";if(Cn(r))return r},A=t=>r=>W(r)===t;function e(t){if(t===null)return"null";switch(typeof t){case"undefined":return"undefined";case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"function":return"Function";case"bigint":return"bigint";case"symbol":return"symbol";default:}if(e.observable(t))return"Observable";if(e.array(t))return"Array";if(e.buffer(t))return"Buffer";let r=W(t);if(r)return r;if(t instanceof String||t instanceof Boolean||t instanceof Number)throw new TypeError("Please don't use object wrappers for primitive types");return"Object"}e.undefined=B("undefined");e.string=B("string");var Pn=B("number");e.number=t=>Pn(t)&&!e.nan(t);e.bigint=B("bigint");e.function_=B("function");e.null_=t=>t===null;e.class_=t=>e.function_(t)&&t.toString().startsWith("class ");e.boolean=t=>t===!0||t===!1;e.symbol=B("symbol");e.numericString=t=>e.string(t)&&!e.emptyStringOrWhitespace(t)&&!Number.isNaN(Number(t));e.array=(t,r)=>Array.isArray(t)?e.function_(r)?t.every(r):!0:!1;e.buffer=t=>{var r,n,o,y;return(y=(o=(n=(r=t)===null||r===void 0?void 0:r.constructor)===null||n===void 0?void 0:n.isBuffer)===null||o===void 0?void 0:o.call(n,t))!==null&&y!==void 0?y:!1};e.nullOrUndefined=t=>e.null_(t)||e.undefined(t);e.object=t=>!e.null_(t)&&(typeof t=="object"||e.function_(t));e.iterable=t=>{var r;return e.function_((r=t)===null||r===void 0?void 0:r[Symbol.iterator])};e.asyncIterable=t=>{var r;return e.function_((r=t)===null||r===void 0?void 0:r[Symbol.asyncIterator])};e.generator=t=>{var r,n;return e.iterable(t)&&e.function_((r=t)===null||r===void 0?void 0:r.next)&&e.function_((n=t)===null||n===void 0?void 0:n.throw)};e.asyncGenerator=t=>e.asyncIterable(t)&&e.function_(t.next)&&e.function_(t.throw);e.nativePromise=t=>A("Promise")(t);var Dn=t=>{var r,n;return e.function_((r=t)===null||r===void 0?void 0:r.then)&&e.function_((n=t)===null||n===void 0?void 0:n.catch)};e.promise=t=>e.nativePromise(t)||Dn(t);e.generatorFunction=A("GeneratorFunction");e.asyncGeneratorFunction=t=>W(t)==="AsyncGeneratorFunction";e.asyncFunction=t=>W(t)==="AsyncFunction";e.boundFunction=t=>e.function_(t)&&!t.hasOwnProperty("prototype");e.regExp=A("RegExp");e.date=A("Date");e.error=A("Error");e.map=t=>A("Map")(t);e.set=t=>A("Set")(t);e.weakMap=t=>A("WeakMap")(t);e.weakSet=t=>A("WeakSet")(t);e.int8Array=A("Int8Array");e.uint8Array=A("Uint8Array");e.uint8ClampedArray=A("Uint8ClampedArray");e.int16Array=A("Int16Array");e.uint16Array=A("Uint16Array");e.int32Array=A("Int32Array");e.uint32Array=A("Uint32Array");e.float32Array=A("Float32Array");e.float64Array=A("Float64Array");e.bigInt64Array=A("BigInt64Array");e.bigUint64Array=A("BigUint64Array");e.arrayBuffer=A("ArrayBuffer");e.sharedArrayBuffer=A("SharedArrayBuffer");e.dataView=A("DataView");e.enumCase=(t,r)=>Object.values(r).includes(t);e.directInstanceOf=(t,r)=>Object.getPrototypeOf(t)===r.prototype;e.urlInstance=t=>A("URL")(t);e.urlString=t=>{if(!e.string(t))return!1;try{return new URL(t),!0}catch(r){return!1}};e.truthy=t=>Boolean(t);e.falsy=t=>!t;e.nan=t=>Number.isNaN(t);e.primitive=t=>e.null_(t)||Nn(typeof t);e.integer=t=>Number.isInteger(t);e.safeInteger=t=>Number.isSafeInteger(t);e.plainObject=t=>{if(wr.call(t)!=="[object Object]")return!1;let r=Object.getPrototypeOf(t);return r===null||r===Object.getPrototypeOf({})};e.typedArray=t=>Tn(W(t));var Vn=t=>e.safeInteger(t)&&t>=0;e.arrayLike=t=>!e.nullOrUndefined(t)&&!e.function_(t)&&Vn(t.length);e.inRange=(t,r)=>{if(e.number(r))return t>=Math.min(0,r)&&t<=Math.max(r,0);if(e.array(r)&&r.length===2)return t>=Math.min(...r)&&t<=Math.max(...r);throw new TypeError(`Invalid range: ${JSON.stringify(r)}`)};var Fn=1,Mn=["innerHTML","ownerDocument","style","attributes","nodeValue"];e.domElement=t=>e.object(t)&&t.nodeType===Fn&&e.string(t.nodeName)&&!e.plainObject(t)&&Mn.every(r=>r in t);e.observable=t=>{var r,n,o,y;return t?t===((n=(r=t)[Symbol.observable])===null||n===void 0?void 0:n.call(r))||t===((y=(o=t)["@@observable"])===null||y===void 0?void 0:y.call(o)):!1};e.nodeStream=t=>e.object(t)&&e.function_(t.pipe)&&!e.observable(t);e.infinite=t=>t===1/0||t===-1/0;var Ir=t=>r=>e.integer(r)&&Math.abs(r%2)===t;e.evenInteger=Ir(0);e.oddInteger=Ir(1);e.emptyArray=t=>e.array(t)&&t.length===0;e.nonEmptyArray=t=>e.array(t)&&t.length>0;e.emptyString=t=>e.string(t)&&t.length===0;e.nonEmptyString=t=>e.string(t)&&t.length>0;var Un=t=>e.string(t)&&!/\S/.test(t);e.emptyStringOrWhitespace=t=>e.emptyString(t)||Un(t);e.emptyObject=t=>e.object(t)&&!e.map(t)&&!e.set(t)&&Object.keys(t).length===0;e.nonEmptyObject=t=>e.object(t)&&!e.map(t)&&!e.set(t)&&Object.keys(t).length>0;e.emptySet=t=>e.set(t)&&t.size===0;e.nonEmptySet=t=>e.set(t)&&t.size>0;e.emptyMap=t=>e.map(t)&&t.size===0;e.nonEmptyMap=t=>e.map(t)&&t.size>0;e.propertyKey=t=>e.any([e.string,e.number,e.symbol],t);e.formData=t=>A("FormData")(t);e.urlSearchParams=t=>A("URLSearchParams")(t);var Tr=(t,r,n)=>{if(!e.function_(r))throw new TypeError(`Invalid predicate: ${JSON.stringify(r)}`);if(n.length===0)throw new TypeError("Invalid number of values");return t.call(n,r)};e.any=(t,...r)=>(e.array(t)?t:[t]).some(o=>Tr(Array.prototype.some,o,r));e.all=(t,...r)=>Tr(Array.prototype.every,t,r);var a=(t,r,n,o={})=>{if(!t){let{multipleValues:y}=o,p=y?`received values of types ${[...new Set(n.map(_=>`\`${e(_)}\``))].join(", ")}`:`received value of type \`${e(n)}\``;throw new TypeError(`Expected value which is \`${r}\`, ${p}.`)}};C.assert={undefined:t=>a(e.undefined(t),"undefined",t),string:t=>a(e.string(t),"string",t),number:t=>a(e.number(t),"number",t),bigint:t=>a(e.bigint(t),"bigint",t),function_:t=>a(e.function_(t),"Function",t),null_:t=>a(e.null_(t),"null",t),class_:t=>a(e.class_(t),"Class",t),boolean:t=>a(e.boolean(t),"boolean",t),symbol:t=>a(e.symbol(t),"symbol",t),numericString:t=>a(e.numericString(t),"string with a number",t),array:(t,r)=>{a(e.array(t),"Array",t),r&&t.forEach(r)},buffer:t=>a(e.buffer(t),"Buffer",t),nullOrUndefined:t=>a(e.nullOrUndefined(t),"null or undefined",t),object:t=>a(e.object(t),"Object",t),iterable:t=>a(e.iterable(t),"Iterable",t),asyncIterable:t=>a(e.asyncIterable(t),"AsyncIterable",t),generator:t=>a(e.generator(t),"Generator",t),asyncGenerator:t=>a(e.asyncGenerator(t),"AsyncGenerator",t),nativePromise:t=>a(e.nativePromise(t),"native Promise",t),promise:t=>a(e.promise(t),"Promise",t),generatorFunction:t=>a(e.generatorFunction(t),"GeneratorFunction",t),asyncGeneratorFunction:t=>a(e.asyncGeneratorFunction(t),"AsyncGeneratorFunction",t),asyncFunction:t=>a(e.asyncFunction(t),"AsyncFunction",t),boundFunction:t=>a(e.boundFunction(t),"Function",t),regExp:t=>a(e.regExp(t),"RegExp",t),date:t=>a(e.date(t),"Date",t),error:t=>a(e.error(t),"Error",t),map:t=>a(e.map(t),"Map",t),set:t=>a(e.set(t),"Set",t),weakMap:t=>a(e.weakMap(t),"WeakMap",t),weakSet:t=>a(e.weakSet(t),"WeakSet",t),int8Array:t=>a(e.int8Array(t),"Int8Array",t),uint8Array:t=>a(e.uint8Array(t),"Uint8Array",t),uint8ClampedArray:t=>a(e.uint8ClampedArray(t),"Uint8ClampedArray",t),int16Array:t=>a(e.int16Array(t),"Int16Array",t),uint16Array:t=>a(e.uint16Array(t),"Uint16Array",t),int32Array:t=>a(e.int32Array(t),"Int32Array",t),uint32Array:t=>a(e.uint32Array(t),"Uint32Array",t),float32Array:t=>a(e.float32Array(t),"Float32Array",t),float64Array:t=>a(e.float64Array(t),"Float64Array",t),bigInt64Array:t=>a(e.bigInt64Array(t),"BigInt64Array",t),bigUint64Array:t=>a(e.bigUint64Array(t),"BigUint64Array",t),arrayBuffer:t=>a(e.arrayBuffer(t),"ArrayBuffer",t),sharedArrayBuffer:t=>a(e.sharedArrayBuffer(t),"SharedArrayBuffer",t),dataView:t=>a(e.dataView(t),"DataView",t),enumCase:(t,r)=>a(e.enumCase(t,r),"EnumCase",t),urlInstance:t=>a(e.urlInstance(t),"URL",t),urlString:t=>a(e.urlString(t),"string with a URL",t),truthy:t=>a(e.truthy(t),"truthy",t),falsy:t=>a(e.falsy(t),"falsy",t),nan:t=>a(e.nan(t),"NaN",t),primitive:t=>a(e.primitive(t),"primitive",t),integer:t=>a(e.integer(t),"integer",t),safeInteger:t=>a(e.safeInteger(t),"integer",t),plainObject:t=>a(e.plainObject(t),"plain object",t),typedArray:t=>a(e.typedArray(t),"TypedArray",t),arrayLike:t=>a(e.arrayLike(t),"array-like",t),domElement:t=>a(e.domElement(t),"HTMLElement",t),observable:t=>a(e.observable(t),"Observable",t),nodeStream:t=>a(e.nodeStream(t),"Node.js Stream",t),infinite:t=>a(e.infinite(t),"infinite number",t),emptyArray:t=>a(e.emptyArray(t),"empty array",t),nonEmptyArray:t=>a(e.nonEmptyArray(t),"non-empty array",t),emptyString:t=>a(e.emptyString(t),"empty string",t),nonEmptyString:t=>a(e.nonEmptyString(t),"non-empty string",t),emptyStringOrWhitespace:t=>a(e.emptyStringOrWhitespace(t),"empty string or whitespace",t),emptyObject:t=>a(e.emptyObject(t),"empty object",t),nonEmptyObject:t=>a(e.nonEmptyObject(t),"non-empty object",t),emptySet:t=>a(e.emptySet(t),"empty set",t),nonEmptySet:t=>a(e.nonEmptySet(t),"non-empty set",t),emptyMap:t=>a(e.emptyMap(t),"empty map",t),nonEmptyMap:t=>a(e.nonEmptyMap(t),"non-empty map",t),propertyKey:t=>a(e.propertyKey(t),"PropertyKey",t),formData:t=>a(e.formData(t),"FormData",t),urlSearchParams:t=>a(e.urlSearchParams(t),"URLSearchParams",t),evenInteger:t=>a(e.evenInteger(t),"even integer",t),oddInteger:t=>a(e.oddInteger(t),"odd integer",t),directInstanceOf:(t,r)=>a(e.directInstanceOf(t,r),"T",t),inRange:(t,r)=>a(e.inRange(t,r),"in range",t),any:(t,...r)=>a(e.any(t,...r),"predicate returns truthy for any value",r,{multipleValues:!0}),all:(t,...r)=>a(e.all(t,...r),"predicate returns truthy for all values",r,{multipleValues:!0})};Object.defineProperties(e,{class:{value:e.class_},function:{value:e.function_},null:{value:e.null_}});Object.defineProperties(C.assert,{class:{value:C.assert.class_},function:{value:C.assert.function_},null:{value:C.assert.null_}});C.default=e;at.exports=e;at.exports.default=e;at.exports.assert=C.assert});var Gn={};kr(Gn,{deepContains:()=>Nr,defaults:()=>xr,version:()=>Bn});var st=X(Ct(),1);var ot=X(br(),1),Sr=X(_r(),1);function In(t){if(t.includes(".")){let r=t.lastIndexOf(".");if(!t.slice(0,r).includes("."))return t.slice(0,r);for(let n=r-1;n--;)if(t[n]===".")return t.slice(n+1,r)}return null}var St=In;function Or(t,r){let n={now:!1};function o(y,p,_,m){let d=(0,ot.default)(y),S,f=I({depth:-1,path:""},_);if(f.depth+=1,Array.isArray(d))for(let s=0,b=d.length;s<b&&!m.now;s++){let O=f.path?`${f.path}.${s}`:`${s}`;d[s]!==void 0?(f.parent=(0,ot.default)(d),f.parentType="array",f.parentKey=St(O),S=o(p(d[s],void 0,L(I({},f),{path:O}),m),p,L(I({},f),{path:O}),m),Number.isNaN(S)&&s<d.length?(d.splice(s,1),s-=1):d[s]=S):d.splice(s,1)}else if((0,Sr.default)(d))for(let s in d){if(m.now&&s!=null)break;let b=f.path?`${f.path}.${s}`:s;f.depth===0&&s!=null&&(f.topmostKey=s),f.parent=(0,ot.default)(d),f.parentType="object",f.parentKey=St(b),S=o(p(s,d[s],L(I({},f),{path:b}),m),p,L(I({},f),{path:b}),m),Number.isNaN(S)?delete d[s]:d[s]=S}return d}return o(t,r,{},n)}var x=X(jr(),1);var Cr="4.0.12";var Bn=Cr;function kn(t){if(t.includes(".")){for(let r=t.length;r--;)if(t[r]===".")return t.slice(0,r)}return t}function Rn(t,r){return Array.from(t).filter((n,o)=>o!==r)}var xr={skipContainers:!0,arrayStrictComparison:!1};function Nr(t,r,n,o,y){let p=I(I({},xr),y);(0,x.default)(t)!==(0,x.default)(r)?o(`the first input arg is of a type ${(0,x.default)(t).toLowerCase()} but the second is ${(0,x.default)(r).toLowerCase()}. Values are - 1st:
11
+ ${JSON.stringify(t,null,4)}
12
+ 2nd:
13
+ ${JSON.stringify(r,null,4)}`):Or(r,(_,m,d,S)=>{let f=m!==void 0?m:_,{path:s}=d;if(st.default.has(t,s))if(!p.arrayStrictComparison&&x.default.plainObject(f)&&d.parentType==="array"&&d.parent.length>1){S.now=!0;let b=Array.from(d.path.includes(".")?st.default.get(t,kn(s)):t);if(b.length<d.parent.length)o(`the first array: ${JSON.stringify(b,null,4)}
14
+ has less objects than array we're matching against, ${JSON.stringify(d.parent,null,4)}`);else{let O=d.parent,E=b.map((l,g)=>g),k=O.map((l,g)=>g),u=[];for(let l=0,g=E.length;l<g;l++){let $=[],w=E[l],R=Rn(E,l);$.push(w),R.forEach(Pr=>{u.push(Array.from($).concat(Pr))})}let i=u.map(l=>l.map((g,$)=>[$,g])),c=0;for(let l=0,g=i.length;l<g;l++){let $=0;i[l].forEach(w=>{x.default.plainObject(O[w[0]])&&x.default.plainObject(b[w[1]])&&Object.keys(O[w[0]]).forEach(R=>{Object.keys(b[w[1]]).includes(R)&&($+=1,b[w[1]][R]===O[w[0]][R]&&($+=5))})}),i[l].push($),$>c&&(c=$)}for(let l=0,g=i.length;l<g;l++)if(i[l][2]===c){i[l].forEach(($,w)=>{w<i[l].length-1&&Nr(b[$[1]],O[$[0]],n,o,p)});break}}}else{let b=st.default.get(t,s);(!p.skipContainers||!x.default.plainObject(b)&&!Array.isArray(b))&&n(b,f,s)}else o(`the first input: ${JSON.stringify(t,null,4)}
15
+ does not have the path "${s}", we were looking, would it contain a value ${JSON.stringify(f,null,0)}.`);return f})}return Rr(Gn);})();
19
16
  /**
20
17
  * @name ast-monkey-traverse
21
18
  * @fileoverview Utility library to traverse AST
22
- * @version 3.0.6
19
+ * @version 3.0.12
23
20
  * @author Roy Revelt, Codsen Ltd
24
21
  * @license MIT
25
22
  * {@link https://codsen.com/os/ast-monkey-traverse/}
26
- */var h={exports:{}};!function(t,e){Object.defineProperty(e,"__esModule",{value:!0});const r=["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];const n=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","FormData","URLSearchParams","HTMLElement",...r];const a=["null","undefined","string","number","bigint","boolean","symbol"];function o(t){return e=>typeof e===t}const{toString:i}=Object.prototype,u=t=>{const e=i.call(t).slice(8,-1);return/HTML\w+Element/.test(e)&&s.domElement(t)?"HTMLElement":n.includes(e)?e:void 0},c=t=>e=>u(e)===t;function s(t){if(null===t)return"null";switch(typeof t){case"undefined":return"undefined";case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"function":return"Function";case"bigint":return"bigint";case"symbol":return"symbol"}if(s.observable(t))return"Observable";if(s.array(t))return"Array";if(s.buffer(t))return"Buffer";const e=u(t);if(e)return e;if(t instanceof String||t instanceof Boolean||t instanceof Number)throw new TypeError("Please don't use object wrappers for primitive types");return"Object"}s.undefined=o("undefined"),s.string=o("string");const l=o("number");s.number=t=>l(t)&&!s.nan(t),s.bigint=o("bigint"),s.function_=o("function"),s.null_=t=>null===t,s.class_=t=>s.function_(t)&&t.toString().startsWith("class "),s.boolean=t=>!0===t||!1===t,s.symbol=o("symbol"),s.numericString=t=>s.string(t)&&!s.emptyStringOrWhitespace(t)&&!Number.isNaN(Number(t)),s.array=(t,e)=>!!Array.isArray(t)&&(!s.function_(e)||t.every(e)),s.buffer=t=>{var e,r,n,a;return null!==(a=null===(n=null===(r=null===(e=t)||void 0===e?void 0:e.constructor)||void 0===r?void 0:r.isBuffer)||void 0===n?void 0:n.call(r,t))&&void 0!==a&&a},s.nullOrUndefined=t=>s.null_(t)||s.undefined(t),s.object=t=>!s.null_(t)&&("object"==typeof t||s.function_(t)),s.iterable=t=>{var e;return s.function_(null===(e=t)||void 0===e?void 0:e[Symbol.iterator])},s.asyncIterable=t=>{var e;return s.function_(null===(e=t)||void 0===e?void 0:e[Symbol.asyncIterator])},s.generator=t=>s.iterable(t)&&s.function_(t.next)&&s.function_(t.throw),s.asyncGenerator=t=>s.asyncIterable(t)&&s.function_(t.next)&&s.function_(t.throw),s.nativePromise=t=>c("Promise")(t);s.promise=t=>s.nativePromise(t)||(t=>{var e,r;return s.function_(null===(e=t)||void 0===e?void 0:e.then)&&s.function_(null===(r=t)||void 0===r?void 0:r.catch)})(t),s.generatorFunction=c("GeneratorFunction"),s.asyncGeneratorFunction=t=>"AsyncGeneratorFunction"===u(t),s.asyncFunction=t=>"AsyncFunction"===u(t),s.boundFunction=t=>s.function_(t)&&!t.hasOwnProperty("prototype"),s.regExp=c("RegExp"),s.date=c("Date"),s.error=c("Error"),s.map=t=>c("Map")(t),s.set=t=>c("Set")(t),s.weakMap=t=>c("WeakMap")(t),s.weakSet=t=>c("WeakSet")(t),s.int8Array=c("Int8Array"),s.uint8Array=c("Uint8Array"),s.uint8ClampedArray=c("Uint8ClampedArray"),s.int16Array=c("Int16Array"),s.uint16Array=c("Uint16Array"),s.int32Array=c("Int32Array"),s.uint32Array=c("Uint32Array"),s.float32Array=c("Float32Array"),s.float64Array=c("Float64Array"),s.bigInt64Array=c("BigInt64Array"),s.bigUint64Array=c("BigUint64Array"),s.arrayBuffer=c("ArrayBuffer"),s.sharedArrayBuffer=c("SharedArrayBuffer"),s.dataView=c("DataView"),s.directInstanceOf=(t,e)=>Object.getPrototypeOf(t)===e.prototype,s.urlInstance=t=>c("URL")(t),s.urlString=t=>{if(!s.string(t))return!1;try{return new URL(t),!0}catch(t){return!1}},s.truthy=t=>Boolean(t),s.falsy=t=>!t,s.nan=t=>Number.isNaN(t),s.primitive=t=>s.null_(t)||a.includes(typeof t),s.integer=t=>Number.isInteger(t),s.safeInteger=t=>Number.isSafeInteger(t),s.plainObject=t=>{if("[object Object]"!==i.call(t))return!1;const e=Object.getPrototypeOf(t);return null===e||e===Object.getPrototypeOf({})},s.typedArray=t=>{return e=u(t),r.includes(e);var e};s.arrayLike=t=>!s.nullOrUndefined(t)&&!s.function_(t)&&(t=>s.safeInteger(t)&&t>=0)(t.length),s.inRange=(t,e)=>{if(s.number(e))return t>=Math.min(0,e)&&t<=Math.max(e,0);if(s.array(e)&&2===e.length)return t>=Math.min(...e)&&t<=Math.max(...e);throw new TypeError(`Invalid range: ${JSON.stringify(e)}`)};const f=["innerHTML","ownerDocument","style","attributes","nodeValue"];s.domElement=t=>s.object(t)&&1===t.nodeType&&s.string(t.nodeName)&&!s.plainObject(t)&&f.every((e=>e in t)),s.observable=t=>{var e,r,n,a;return!!t&&(t===(null===(r=(e=t)[Symbol.observable])||void 0===r?void 0:r.call(e))||t===(null===(a=(n=t)["@@observable"])||void 0===a?void 0:a.call(n)))},s.nodeStream=t=>s.object(t)&&s.function_(t.pipe)&&!s.observable(t),s.infinite=t=>t===1/0||t===-1/0;const y=t=>e=>s.integer(e)&&Math.abs(e%2)===t;s.evenInteger=y(0),s.oddInteger=y(1),s.emptyArray=t=>s.array(t)&&0===t.length,s.nonEmptyArray=t=>s.array(t)&&t.length>0,s.emptyString=t=>s.string(t)&&0===t.length,s.nonEmptyString=t=>s.string(t)&&t.length>0;s.emptyStringOrWhitespace=t=>s.emptyString(t)||(t=>s.string(t)&&!/\S/.test(t))(t),s.emptyObject=t=>s.object(t)&&!s.map(t)&&!s.set(t)&&0===Object.keys(t).length,s.nonEmptyObject=t=>s.object(t)&&!s.map(t)&&!s.set(t)&&Object.keys(t).length>0,s.emptySet=t=>s.set(t)&&0===t.size,s.nonEmptySet=t=>s.set(t)&&t.size>0,s.emptyMap=t=>s.map(t)&&0===t.size,s.nonEmptyMap=t=>s.map(t)&&t.size>0,s.propertyKey=t=>s.any([s.string,s.number,s.symbol],t),s.formData=t=>c("FormData")(t),s.urlSearchParams=t=>c("URLSearchParams")(t);const p=(t,e,r)=>{if(!s.function_(e))throw new TypeError(`Invalid predicate: ${JSON.stringify(e)}`);if(0===r.length)throw new TypeError("Invalid number of values");return t.call(r,e)};s.any=(t,...e)=>(s.array(t)?t:[t]).some((t=>p(Array.prototype.some,t,e))),s.all=(t,...e)=>p(Array.prototype.every,t,e);const b=(t,e,r,n={})=>{if(!t){const{multipleValues:t}=n,a=t?`received values of types ${[...new Set(r.map((t=>`\`${s(t)}\``)))].join(", ")}`:`received value of type \`${s(r)}\``;throw new TypeError(`Expected value which is \`${e}\`, ${a}.`)}};e.assert={undefined:t=>b(s.undefined(t),"undefined",t),string:t=>b(s.string(t),"string",t),number:t=>b(s.number(t),"number",t),bigint:t=>b(s.bigint(t),"bigint",t),function_:t=>b(s.function_(t),"Function",t),null_:t=>b(s.null_(t),"null",t),class_:t=>b(s.class_(t),"Class",t),boolean:t=>b(s.boolean(t),"boolean",t),symbol:t=>b(s.symbol(t),"symbol",t),numericString:t=>b(s.numericString(t),"string with a number",t),array:(t,e)=>{b(s.array(t),"Array",t),e&&t.forEach(e)},buffer:t=>b(s.buffer(t),"Buffer",t),nullOrUndefined:t=>b(s.nullOrUndefined(t),"null or undefined",t),object:t=>b(s.object(t),"Object",t),iterable:t=>b(s.iterable(t),"Iterable",t),asyncIterable:t=>b(s.asyncIterable(t),"AsyncIterable",t),generator:t=>b(s.generator(t),"Generator",t),asyncGenerator:t=>b(s.asyncGenerator(t),"AsyncGenerator",t),nativePromise:t=>b(s.nativePromise(t),"native Promise",t),promise:t=>b(s.promise(t),"Promise",t),generatorFunction:t=>b(s.generatorFunction(t),"GeneratorFunction",t),asyncGeneratorFunction:t=>b(s.asyncGeneratorFunction(t),"AsyncGeneratorFunction",t),asyncFunction:t=>b(s.asyncFunction(t),"AsyncFunction",t),boundFunction:t=>b(s.boundFunction(t),"Function",t),regExp:t=>b(s.regExp(t),"RegExp",t),date:t=>b(s.date(t),"Date",t),error:t=>b(s.error(t),"Error",t),map:t=>b(s.map(t),"Map",t),set:t=>b(s.set(t),"Set",t),weakMap:t=>b(s.weakMap(t),"WeakMap",t),weakSet:t=>b(s.weakSet(t),"WeakSet",t),int8Array:t=>b(s.int8Array(t),"Int8Array",t),uint8Array:t=>b(s.uint8Array(t),"Uint8Array",t),uint8ClampedArray:t=>b(s.uint8ClampedArray(t),"Uint8ClampedArray",t),int16Array:t=>b(s.int16Array(t),"Int16Array",t),uint16Array:t=>b(s.uint16Array(t),"Uint16Array",t),int32Array:t=>b(s.int32Array(t),"Int32Array",t),uint32Array:t=>b(s.uint32Array(t),"Uint32Array",t),float32Array:t=>b(s.float32Array(t),"Float32Array",t),float64Array:t=>b(s.float64Array(t),"Float64Array",t),bigInt64Array:t=>b(s.bigInt64Array(t),"BigInt64Array",t),bigUint64Array:t=>b(s.bigUint64Array(t),"BigUint64Array",t),arrayBuffer:t=>b(s.arrayBuffer(t),"ArrayBuffer",t),sharedArrayBuffer:t=>b(s.sharedArrayBuffer(t),"SharedArrayBuffer",t),dataView:t=>b(s.dataView(t),"DataView",t),urlInstance:t=>b(s.urlInstance(t),"URL",t),urlString:t=>b(s.urlString(t),"string with a URL",t),truthy:t=>b(s.truthy(t),"truthy",t),falsy:t=>b(s.falsy(t),"falsy",t),nan:t=>b(s.nan(t),"NaN",t),primitive:t=>b(s.primitive(t),"primitive",t),integer:t=>b(s.integer(t),"integer",t),safeInteger:t=>b(s.safeInteger(t),"integer",t),plainObject:t=>b(s.plainObject(t),"plain object",t),typedArray:t=>b(s.typedArray(t),"TypedArray",t),arrayLike:t=>b(s.arrayLike(t),"array-like",t),domElement:t=>b(s.domElement(t),"HTMLElement",t),observable:t=>b(s.observable(t),"Observable",t),nodeStream:t=>b(s.nodeStream(t),"Node.js Stream",t),infinite:t=>b(s.infinite(t),"infinite number",t),emptyArray:t=>b(s.emptyArray(t),"empty array",t),nonEmptyArray:t=>b(s.nonEmptyArray(t),"non-empty array",t),emptyString:t=>b(s.emptyString(t),"empty string",t),nonEmptyString:t=>b(s.nonEmptyString(t),"non-empty string",t),emptyStringOrWhitespace:t=>b(s.emptyStringOrWhitespace(t),"empty string or whitespace",t),emptyObject:t=>b(s.emptyObject(t),"empty object",t),nonEmptyObject:t=>b(s.nonEmptyObject(t),"non-empty object",t),emptySet:t=>b(s.emptySet(t),"empty set",t),nonEmptySet:t=>b(s.nonEmptySet(t),"non-empty set",t),emptyMap:t=>b(s.emptyMap(t),"empty map",t),nonEmptyMap:t=>b(s.nonEmptyMap(t),"non-empty map",t),propertyKey:t=>b(s.propertyKey(t),"PropertyKey",t),formData:t=>b(s.formData(t),"FormData",t),urlSearchParams:t=>b(s.urlSearchParams(t),"URLSearchParams",t),evenInteger:t=>b(s.evenInteger(t),"even integer",t),oddInteger:t=>b(s.oddInteger(t),"odd integer",t),directInstanceOf:(t,e)=>b(s.directInstanceOf(t,e),"T",t),inRange:(t,e)=>b(s.inRange(t,e),"in range",t),any:(t,...e)=>b(s.any(t,...e),"predicate returns truthy for any value",e,{multipleValues:!0}),all:(t,...e)=>b(s.all(t,...e),"predicate returns truthy for all values",e,{multipleValues:!0})},Object.defineProperties(s,{class:{value:s.class_},function:{value:s.function_},null:{value:s.null_}}),Object.defineProperties(e.assert,{class:{value:e.assert.class_},function:{value:e.assert.function_},null:{value:e.assert.null_}}),e.default=s,t.exports=s,t.exports.default=s,t.exports.assert=e.assert}(h,h.exports);var m=r(h.exports);function v(t,e){return Array.from(t).filter(((t,r)=>r!==e))}const _={skipContainers:!0,arrayStrictComparison:!1};t.deepContains=function t(e,r,n,o,u){const c={..._,...u};m(e)!==m(r)?o(`the first input arg is of a type ${m(e).toLowerCase()} but the second is ${m(r).toLowerCase()}. Values are - 1st:\n${JSON.stringify(e,null,4)}\n2nd:\n${JSON.stringify(r,null,4)}`):function(t,e){(function t(e,r,n,a){const o=i(e);let u;const c={depth:-1,path:"",...n};if(c.depth+=1,Array.isArray(o))for(let e=0,n=o.length;e<n&&!a.now;e++){const n=c.path?`${c.path}.${e}`:`${e}`;void 0!==o[e]?(c.parent=i(o),c.parentType="array",c.parentKey=g(n),u=t(r(o[e],void 0,{...c,path:n},a),r,{...c,path:n},a),Number.isNaN(u)&&e<o.length?(o.splice(e,1),e-=1):o[e]=u):o.splice(e,1)}else if(d(o))for(const e in o){if(a.now&&null!=e)break;const n=c.path?`${c.path}.${e}`:e;0===c.depth&&null!=e&&(c.topmostKey=e),c.parent=i(o),c.parentType="object",c.parentKey=g(n),u=t(r(e,o[e],{...c,path:n},a),r,{...c,path:n},a),Number.isNaN(u)?delete o[e]:o[e]=u}return o})(t,e,{},{now:!1})}(r,((r,i,u,s)=>{const l=void 0!==i?i:r,{path:f}=u;if(a.has(e,f))if(!c.arrayStrictComparison&&m.plainObject(l)&&"array"===u.parentType&&u.parent.length>1){s.now=!0;const r=Array.from(u.path.includes(".")?a.get(e,function(t){if(t.includes("."))for(let e=t.length;e--;)if("."===t[e])return t.slice(0,e);return t}(f)):e);if(r.length<u.parent.length)o(`the first array: ${JSON.stringify(r,null,4)}\nhas less objects than array we're matching against, ${JSON.stringify(u.parent,null,4)}`);else{const e=u.parent,a=r.map(((t,e)=>e));e.map(((t,e)=>e));const i=[];for(let t=0,e=a.length;t<e;t++){const e=[],r=a[t],n=v(a,t);e.push(r),n.forEach((t=>{i.push(Array.from(e).concat(t))}))}const s=i.map((t=>t.map(((t,e)=>[e,t]))));let l=0;for(let t=0,n=s.length;t<n;t++){let n=0;s[t].forEach((t=>{m.plainObject(e[t[0]])&&m.plainObject(r[t[1]])&&Object.keys(e[t[0]]).forEach((a=>{Object.keys(r[t[1]]).includes(a)&&(n+=1,r[t[1]][a]===e[t[0]][a]&&(n+=5))}))})),s[t].push(n),n>l&&(l=n)}for(let a=0,i=s.length;a<i;a++)if(s[a][2]===l){s[a].forEach(((i,u)=>{u<s[a].length-1&&t(r[i[1]],e[i[0]],n,o,c)}));break}}}else{const t=a.get(e,f);c.skipContainers&&(m.plainObject(t)||Array.isArray(t))||n(t,l,f)}else o(`the first input: ${JSON.stringify(e,null,4)}\ndoes not have the path "${f}", we were looking, would it contain a value ${JSON.stringify(l,null,0)}.`);return l}))},t.defaults=_,t.version="4.0.6",Object.defineProperty(t,"__esModule",{value:!0})}));
23
+ */
24
+ /**
25
+ * @name ast-monkey-util
26
+ * @fileoverview Utility library of AST helper functions
27
+ * @version 2.0.12
28
+ * @author Roy Revelt, Codsen Ltd
29
+ * @license MIT
30
+ * {@link https://codsen.com/os/ast-monkey-util/}
31
+ */
@@ -1,6 +1,7 @@
1
1
  // Quick Take
2
2
 
3
3
  import { strict as assert } from "assert";
4
+
4
5
  import { deepContains } from "../dist/ast-deep-contains.esm.js";
5
6
 
6
7
  const gathered = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ast-deep-contains",
3
- "version": "4.0.6",
3
+ "version": "4.0.12",
4
4
  "description": "Like t.same assert on array of objects, where element order doesn't matter.",
5
5
  "keywords": [
6
6
  "array",
@@ -48,35 +48,31 @@
48
48
  },
49
49
  "types": "types/index.d.ts",
50
50
  "scripts": {
51
- "build": "rollup -c",
52
- "build:esbuild": "node '../../scripts/esbuild.js'",
53
- "build:esbuild:dev": "cross-env MODE=dev node '../../scripts/esbuild.js'",
54
- "ci_test": "npm run build && npm run format && tap --no-only --reporter=silent",
55
- "clean_types": "../../scripts/cleanTypes.js",
56
- "dev": "rollup -c --dev",
57
- "devunittest": "npm run dev && tap --only -R 'base'",
58
- "format": "npm run lect && npm run prettier && npm run lint",
59
- "lect": "lect",
60
- "lint": "../../node_modules/eslint/bin/eslint.js . --ext .js --ext .ts --fix --config \"../../.eslintrc.json\" --quiet",
61
- "perf": "node perf/check",
62
- "prettier": "../../node_modules/prettier/bin-prettier.js '*.{js,css,scss,vue,md,ts}' --write --loglevel silent",
63
- "republish": "npm publish || :",
64
- "tap": "tap",
65
- "pretest": "npm run build",
66
- "test": "npm run test:ci && npm run perf",
67
- "test:ci": "npm run unittest && npm run test:examples && npm run format",
68
- "test:examples": "../../scripts/test-examples.js && npm run lect && npm run prettier",
69
- "tsc": "tsc",
70
- "unittest": "tap --no-only --reporter=terse && tsc -p tsconfig.json --noEmit"
51
+ "build": "node '../../ops/scripts/esbuild.js' && yarn run dts",
52
+ "dev": "DEV=true node '../../ops/scripts/esbuild.js' && yarn run dts",
53
+ "devtest": "c8 yarn run unit && yarn run examples && yarn run lint",
54
+ "dts": "rollup -c && yarn run prettier 'types/index.d.ts' --write",
55
+ "examples": "node '../../ops/scripts/run-examples.js'",
56
+ "lect": "node '../../ops/lect/lect.js' && yarn run prettier 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
57
+ "letspublish": "yarn publish || :",
58
+ "lint": "eslint . --fix",
59
+ "perf": "node perf/check.js",
60
+ "prepare": "echo 'ready'",
61
+ "prettier": "prettier",
62
+ "prettier:format": "prettier --write '**/*.{ts,tsx,md}' --no-error-on-unmatched-pattern",
63
+ "pretest": "yarn run lect && yarn run build",
64
+ "test": "yarn run devtest",
65
+ "unit": "uvu test"
71
66
  },
72
- "tap": {
73
- "check-coverage": false,
74
- "node-arg": [
75
- "--no-warnings",
76
- "--experimental-loader",
77
- "@istanbuljs/esm-loader-hook"
67
+ "engines": {
68
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
69
+ },
70
+ "c8": {
71
+ "check-coverage": true,
72
+ "exclude": [
73
+ "**/test/**/*.*"
78
74
  ],
79
- "timeout": 0
75
+ "lines": 100
80
76
  },
81
77
  "lect": {
82
78
  "licence": {
@@ -84,61 +80,15 @@
84
80
  ""
85
81
  ]
86
82
  },
87
- "req": "{ deepContains }",
88
- "various": {
89
- "devDependencies": [
90
- "@types/lodash.isplainobject",
91
- "@types/object-path"
92
- ]
93
- }
83
+ "various": {}
94
84
  },
95
85
  "dependencies": {
96
- "@babel/runtime": "^7.16.3",
97
- "@sindresorhus/is": "^4.2.0",
98
- "ast-monkey-traverse": "^3.0.6",
86
+ "@sindresorhus/is": "^4.3.0",
87
+ "ast-monkey-traverse": "^3.0.12",
99
88
  "object-path": "^0.11.8"
100
89
  },
101
90
  "devDependencies": {
102
- "@babel/cli": "^7.16.0",
103
- "@babel/core": "^7.16.0",
104
- "@babel/node": "^7.16.0",
105
- "@babel/plugin-external-helpers": "^7.16.0",
106
- "@babel/plugin-proposal-class-properties": "^7.16.0",
107
- "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.0",
108
- "@babel/plugin-proposal-object-rest-spread": "^7.16.0",
109
- "@babel/plugin-proposal-optional-chaining": "^7.16.0",
110
- "@babel/plugin-transform-runtime": "^7.16.4",
111
- "@babel/preset-env": "^7.16.4",
112
- "@babel/preset-typescript": "^7.16.0",
113
- "@babel/register": "^7.16.0",
114
- "@istanbuljs/esm-loader-hook": "^0.1.2",
115
- "@rollup/plugin-babel": "^5.3.0",
116
- "@rollup/plugin-commonjs": "^21.0.1",
117
- "@rollup/plugin-json": "^4.1.0",
118
- "@rollup/plugin-node-resolve": "^13.0.6",
119
- "@rollup/plugin-strip": "^2.1.0",
120
- "@rollup/plugin-typescript": "^8.3.0",
121
91
  "@types/lodash.isplainobject": "^4.0.6",
122
- "@types/node": "^16.11.9",
123
- "@types/object-path": "^0.11.1",
124
- "@types/tap": "^15.0.5",
125
- "@typescript-eslint/eslint-plugin": "^5.4.0",
126
- "@typescript-eslint/parser": "^5.4.0",
127
- "core-js": "^3.19.1",
128
- "cross-env": "^7.0.3",
129
- "eslint": "^8.3.0",
130
- "lect": "^0.18.6",
131
- "rollup": "^2.60.0",
132
- "rollup-plugin-ascii": "^0.0.3",
133
- "rollup-plugin-banner": "^0.2.1",
134
- "rollup-plugin-cleanup": "^3.2.1",
135
- "rollup-plugin-dts": "^4.0.1",
136
- "rollup-plugin-terser": "^7.0.2",
137
- "tap": "^15.1.2",
138
- "tslib": "^2.3.1",
139
- "typescript": "^4.5.2"
140
- },
141
- "engines": {
142
- "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
92
+ "@types/object-path": "^0.11.1"
143
93
  }
144
94
  }
package/types/index.d.ts CHANGED
@@ -1,18 +1,24 @@
1
1
  declare const version: string;
2
2
  interface Opts {
3
- skipContainers?: boolean;
4
- arrayStrictComparison?: boolean;
3
+ skipContainers?: boolean;
4
+ arrayStrictComparison?: boolean;
5
5
  }
6
6
  declare const defaults: Opts;
7
7
  interface Callback {
8
- (leftSideVal: any, rightSideVal: any, path: string): void;
8
+ (leftSideVal: any, rightSideVal: any, path: string): void;
9
9
  }
10
10
  interface ErrorCallback {
11
- (errStr: string): void;
11
+ (errStr: string): void;
12
12
  }
13
13
  /**
14
14
  * Like t.same assert on array of objects, where element order doesn't matter.
15
15
  */
16
- declare function deepContains(tree1: any, tree2: any, cb: Callback, errCb: ErrorCallback, originalOpts?: Opts): void;
16
+ declare function deepContains(
17
+ tree1: any,
18
+ tree2: any,
19
+ cb: Callback,
20
+ errCb: ErrorCallback,
21
+ originalOpts?: Opts
22
+ ): void;
17
23
 
18
24
  export { deepContains, defaults, version };
package/examples/api.json DELETED
@@ -1 +0,0 @@
1
- {"_quickTake.js":{"title":"Quick Take","content":"import &#x7B; strict as assert &#x7D; from \"assert\";\nimport &#x7B; deepContains &#x7D; from \"ast-deep-contains\";\n\nconst gathered = [];\nconst errors = [];\n\nconst reference = [\n &#x7B; c: \"2\" &#x7D;, // will end up not used\n &#x7B; a: \"1\", b: \"2\", c: \"3\" &#x7D;,\n &#x7B; x: \"8\", y: \"9\", z: \"0\" &#x7D;,\n];\n\nconst structureToMatch = [\n &#x7B; a: \"1\", b: \"2\", c: \"3\" &#x7D;, // matches but has different position in the source\n &#x7B; x: \"8\", y: \"9\" &#x7D;, // \"z\" missing\n];\n\n// This program pre-matches first, then matches objects as a set-subset\ndeepContains(\n reference,\n structureToMatch,\n (leftSideVal, rightSideVal) => &#x7B;\n // This callback does the pre-matching and picks the key pairs for you.\n // It's up to you what you will do with left- and right-side\n // values - we normally feed them to unit test asserts but here we just push\n // to array:\n gathered.push([leftSideVal, rightSideVal]);\n &#x7D;,\n (err) => &#x7B;\n errors.push(err);\n &#x7D;\n);\n\n// imagine instead of pushing pairs into array, you fed them into assert\n// function in unit tests:\nassert.deepEqual(gathered, [\n [\"1\", \"1\"],\n [\"2\", \"2\"],\n [\"3\", \"3\"],\n [\"8\", \"8\"],\n [\"9\", \"9\"],\n]);\nassert.equal(errors.length, 0);"}}