ast-deep-contains 5.1.3 → 5.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -2
- package/LICENSE +1 -1
- package/README.md +8 -28
- package/dist/ast-deep-contains.esm.js +6 -6
- package/dist/ast-deep-contains.umd.js +4 -12
- package/package.json +21 -23
- package/types/index.d.ts +2 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,11 +3,23 @@
|
|
|
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
|
-
## 5.
|
|
6
|
+
## 5.2.0 (2026-08-19)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- match every object in unordered arrays ([70e67d9](https://github.com/codsen/codsen/commit/70e67d9d786168ce986855ab2a53a76376a9152c))
|
|
11
|
+
- resolve review findings REV-004 through REV-007 ([b60e9ee](https://github.com/codsen/codsen/commit/b60e9eeb499af94685cfb87b4970fe025be1fc10))
|
|
12
|
+
- retire direct publish aliases ([f98e31e](https://github.com/codsen/codsen/commit/f98e31eb89bc185471225664e610b55f34fbf648))
|
|
7
13
|
|
|
8
14
|
### Features
|
|
9
15
|
|
|
10
|
-
-
|
|
16
|
+
- add codsen-glob and migrate glob consumers ([5595a2b](https://github.com/codsen/codsen/commit/5595a2b267eaa6cb60072d037aef00b7a28edd42))
|
|
17
|
+
- refresh the tooling and generate with the latest dependencies ([781f802](https://github.com/codsen/codsen/commit/781f802911066a82a4533b0e5a3fcbd742d0dd83))
|
|
18
|
+
|
|
19
|
+
### Reverts
|
|
20
|
+
|
|
21
|
+
- Revert "Merge pull request #128 from codsen/release/npm-32198404552-1" ([5baeeaa](https://github.com/codsen/codsen/commit/5baeeaaa677b86f1eaa6396cadf3aea32b06416e)), closes [#128](https://github.com/codsen/codsen/issues/128)
|
|
22
|
+
- Revert "Merge pull request #127 from codsen/release/npm-32194020886-1" ([5f1e94d](https://github.com/codsen/codsen/commit/5f1e94deef910ce735266b16aeee08a76de7a862)), closes [#127](https://github.com/codsen/codsen/issues/127)
|
|
11
23
|
|
|
12
24
|
## 5.0.0 (2022-12-01)
|
|
13
25
|
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright © 2010-
|
|
3
|
+
Copyright © 2010-2026 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
|
@@ -32,33 +32,17 @@ npm i ast-deep-contains
|
|
|
32
32
|
## Quick Take
|
|
33
33
|
|
|
34
34
|
```js
|
|
35
|
-
import { strict as assert } from "assert";
|
|
35
|
+
import { strict as assert } from "node:assert";
|
|
36
36
|
|
|
37
37
|
import { deepContains } from "ast-deep-contains";
|
|
38
38
|
|
|
39
39
|
const gathered = [];
|
|
40
40
|
const errors = [];
|
|
41
41
|
|
|
42
|
-
const reference = [
|
|
43
|
-
{ c: "2" }, // will end up not used
|
|
44
|
-
{ a: "1", b: "2", c: "3" },
|
|
45
|
-
{ x: "8", y: "9", z: "0" },
|
|
46
|
-
];
|
|
47
|
-
|
|
48
|
-
const structureToMatch = [
|
|
49
|
-
{ a: "1", b: "2", c: "3" }, // matches but has different position in the source
|
|
50
|
-
{ x: "8", y: "9" }, // "z" missing
|
|
51
|
-
];
|
|
52
|
-
|
|
53
|
-
// This program pre-matches first, then matches objects as a set-subset
|
|
54
42
|
deepContains(
|
|
55
|
-
|
|
56
|
-
|
|
43
|
+
{ title: "Release notes", author: "Ada", draft: false },
|
|
44
|
+
{ title: "Release notes", author: "Ada" },
|
|
57
45
|
(leftSideVal, rightSideVal) => {
|
|
58
|
-
// This callback does the pre-matching and picks the key pairs for you.
|
|
59
|
-
// It's up to you what you will do with left- and right-side
|
|
60
|
-
// values - we normally feed them to unit test asserts but here we just push
|
|
61
|
-
// to array:
|
|
62
46
|
gathered.push([leftSideVal, rightSideVal]);
|
|
63
47
|
},
|
|
64
48
|
(err) => {
|
|
@@ -66,21 +50,17 @@ deepContains(
|
|
|
66
50
|
},
|
|
67
51
|
);
|
|
68
52
|
|
|
69
|
-
// imagine instead of pushing pairs into array, you fed them into assert
|
|
70
|
-
// function in unit tests:
|
|
71
53
|
assert.deepEqual(gathered, [
|
|
72
|
-
["
|
|
73
|
-
["
|
|
74
|
-
["3", "3"],
|
|
75
|
-
["8", "8"],
|
|
76
|
-
["9", "9"],
|
|
54
|
+
["Release notes", "Release notes"],
|
|
55
|
+
["Ada", "Ada"],
|
|
77
56
|
]);
|
|
78
57
|
assert.equal(errors.length, 0);
|
|
79
58
|
```
|
|
80
59
|
|
|
60
|
+
|
|
81
61
|
## Documentation
|
|
82
62
|
|
|
83
|
-
Please [visit codsen.com](https://codsen.com/os/ast-deep-contains/) for a full description of the API.
|
|
63
|
+
Please [visit codsen.com](https://codsen.com/os/ast-deep-contains/) for a full description of the API. If you’re looking for the **Changelog**, it’s [here](https://github.com/codsen/codsen/blob/main/packages/ast-deep-contains/CHANGELOG.md).
|
|
84
64
|
|
|
85
65
|
## Contributing
|
|
86
66
|
|
|
@@ -90,6 +70,6 @@ To report bugs or request features or assistance, [raise an issue](https://githu
|
|
|
90
70
|
|
|
91
71
|
MIT License
|
|
92
72
|
|
|
93
|
-
Copyright © 2010-
|
|
73
|
+
Copyright © 2010-2026 Roy Revelt and other contributors
|
|
94
74
|
|
|
95
75
|
<p align="center"><img src="https://codsen.com/images/png-codsen-ok.png" width="98" alt="ok" align="center"> <img src="https://codsen.com/images/png-codsen-1.png" width="148" alt="codsen" align="center"> <img src="https://codsen.com/images/png-codsen-star-small.png" width="32" alt="star" align="center"></p>
|
|
@@ -1,15 +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 5.1
|
|
4
|
+
* @version 5.2.1
|
|
5
5
|
* @author Roy Revelt
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/ast-deep-contains/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import
|
|
11
|
-
${JSON.stringify(
|
|
10
|
+
import{traverse as v}from"ast-monkey-traverse";import w from"object-path";var k="5.2.1";var P=k;function E(e){if(e.includes(".")){for(let r=e.length;r--;)if(e[r]===".")return e.slice(0,r)}return e}function g(e){if(e===null||typeof e!="object")return!1;let r=Object.getPrototypeOf(e);return r===null||r===Object.prototype}function j(e){return e===null?"null":Array.isArray(e)?"array":typeof e=="number"&&Number.isNaN(e)?"nan":typeof e!="object"?typeof e:Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}var N={skipContainers:!0,arrayStrictComparison:!1};function x(e,r,c,o,h){let m={...N,...h},d=j(e),l=j(r);d!==l?o(`the first input arg is of a type ${d} but the second is ${l}. Values are - 1st:
|
|
11
|
+
${JSON.stringify(e,null,4)}
|
|
12
12
|
2nd:
|
|
13
|
-
${JSON.stringify(
|
|
14
|
-
has less objects than array we're matching against, ${JSON.stringify(
|
|
15
|
-
does not have the path "${
|
|
13
|
+
${JSON.stringify(r,null,4)}`):v(r,(y,f,t,s)=>{let a=f!==void 0?f:y,{path:u}=t;if(w.has(e,u))if(!m.arrayStrictComparison&&g(a)&&t.parentType==="array"&&t.parent.length>1){s.now=!0;let i=Array.from(t.path.includes(".")?w.get(e,E(u)):e);if(i.length<t.parent.length)o(`the first array: ${JSON.stringify(i,null,4)}
|
|
14
|
+
has less objects than array we're matching against, ${JSON.stringify(t.parent,null,4)}`);else{let p=t.parent,b=I(p,i);for(let[n,$]of b)x(i[$],p[n],c,o,m)}}else{let i=w.get(e,u);(!m.skipContainers||!g(i)&&!Array.isArray(i))&&c(i,a,u)}else o(`the first input: ${JSON.stringify(e,null,4)}
|
|
15
|
+
does not have the path "${u}", we were looking, would it contain a value ${JSON.stringify(a,null,0)}.`);return a})}var S=Object.prototype.hasOwnProperty;function C(e,r){if(!g(e)||!g(r))return 0;let c=0;for(let o of Object.keys(e))S.call(r,o)&&(c+=r[o]===e[o]?6:1);return c}function I(e,r){let c=e.length,o=r.length,h=e.map(t=>r.map(s=>C(t,s))),m=new Array(c+1).fill(0),d=new Array(o+1).fill(0),l=new Array(o+1).fill(0),y=new Array(o+1).fill(0);for(let t=1;t<=c;t++){l[0]=t;let s=0,a=new Array(o+1).fill(Number.POSITIVE_INFINITY),u=new Array(o+1).fill(!1);do{u[s]=!0;let i=l[s],p=Number.POSITIVE_INFINITY,b=0;for(let n=1;n<=o;n++){if(u[n])continue;let $=-h[i-1][n-1]-m[i]-d[n];$<a[n]&&(a[n]=$,y[n]=s),a[n]<p&&(p=a[n],b=n)}for(let n=0;n<=o;n++)u[n]?(m[l[n]]+=p,d[n]-=p):a[n]-=p;s=b}while(l[s]!==0);do{let i=y[s];l[s]=l[i],s=i}while(s!==0)}let f=new Array(c);for(let t=1;t<=o;t++)l[t]>0&&(f[l[t]-1]=t-1);return f.map((t,s)=>[s,t])}export{x as deepContains,N as defaults,P as version};
|
|
@@ -1,33 +1,25 @@
|
|
|
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 5.1
|
|
4
|
+
* @version 5.2.1
|
|
5
5
|
* @author Roy Revelt
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/ast-deep-contains/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
"use strict";var astDeepContains=(()=>{var Cr=Object.create;var j=Object.defineProperty,Ur=Object.defineProperties,Vr=Object.getOwnPropertyDescriptor,Mr=Object.getOwnPropertyDescriptors,Rr=Object.getOwnPropertyNames,q=Object.getOwnPropertySymbols,Lr=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty,Wr=Object.prototype.propertyIsEnumerable;var z=(r,t,u)=>t in r?j(r,t,{enumerable:!0,configurable:!0,writable:!0,value:u}):r[t]=u,T=(r,t)=>{for(var u in t||(t={}))Y.call(t,u)&&z(r,u,t[u]);if(q)for(var u of q(t))Wr.call(t,u)&&z(r,u,t[u]);return r},B=(r,t)=>Ur(r,Mr(t));var Z=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),Gr=(r,t)=>{for(var u in t)j(r,u,{get:t[u],enumerable:!0})},X=(r,t,u,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let b of Rr(t))!Y.call(r,b)&&b!==u&&j(r,b,{get:()=>t[b],enumerable:!(s=Vr(t,b))||s.enumerable});return r};var G=(r,t,u)=>(u=r!=null?Cr(Lr(r)):{},X(t||!r||!r.__esModule?j(u,"default",{value:r,enumerable:!0}):u,r)),Jr=r=>X(j({},"__esModule",{value:!0}),r);var rr=Z((v,M)=>{(function(r,t){"use strict";typeof M=="object"&&typeof M.exports=="object"?M.exports=t():typeof define=="function"&&define.amd?define([],t):r.objectPath=t()})(v,function(){"use strict";var r=Object.prototype.toString;function t(o,n){return o==null?!1:Object.prototype.hasOwnProperty.call(o,n)}function u(o){if(!o||A(o)&&o.length===0)return!0;if(typeof o!="string"){for(var n in o)if(t(o,n))return!1;return!0}return!1}function s(o){return r.call(o)}function b(o){return typeof o=="object"&&s(o)==="[object Object]"}var A=Array.isArray||function(o){return r.call(o)==="[object Array]"};function a(o){return typeof o=="boolean"||s(o)==="[object Boolean]"}function d(o){var n=parseInt(o);return n.toString()===o?n:o}function i(o){o=o||{};var n=function(p){return Object.keys(n).reduce(function(e,f){return f==="create"||typeof n[f]=="function"&&(e[f]=n[f].bind(n,p)),e},{})},l;o.includeInheritedProps?l=function(){return!0}:l=function(p,e){return typeof e=="number"&&Array.isArray(p)||t(p,e)};function S(p,e){if(l(p,e))return p[e]}var x;o.includeInheritedProps?x=function(p,e){typeof e!="string"&&typeof e!="number"&&(e=String(e));var f=S(p,e);if(e==="__proto__"||e==="prototype"||e==="constructor"&&typeof f=="function")throw new Error("For security reasons, object's magic properties cannot be set");return f}:x=function(p,e){return S(p,e)};function I(p,e,f,y){if(typeof e=="number"&&(e=[e]),!e||e.length===0)return p;if(typeof e=="string")return I(p,e.split(".").map(d),f,y);var w=e[0],E=x(p,w);return e.length===1?((E===void 0||!y)&&(p[w]=f),E):(E===void 0&&(typeof e[1]=="number"?p[w]=[]:p[w]={}),I(p[w],e.slice(1),f,y))}return n.has=function(p,e){if(typeof e=="number"?e=[e]:typeof e=="string"&&(e=e.split(".")),!e||e.length===0)return!!p;for(var f=0;f<e.length;f++){var y=d(e[f]);if(typeof y=="number"&&A(p)&&y<p.length||(o.includeInheritedProps?y in Object(p):t(p,y)))p=p[y];else return!1}return!0},n.ensureExists=function(p,e,f){return I(p,e,f,!0)},n.set=function(p,e,f,y){return I(p,e,f,y)},n.insert=function(p,e,f,y){var w=n.get(p,e);y=~~y,A(w)||(w=[],n.set(p,e,w)),w.splice(y,0,f)},n.empty=function(p,e){if(!u(e)&&p!=null){var f,y;if(f=n.get(p,e)){if(typeof f=="string")return n.set(p,e,"");if(a(f))return n.set(p,e,!1);if(typeof f=="number")return n.set(p,e,0);if(A(f))f.length=0;else if(b(f))for(y in f)l(f,y)&&delete f[y];else return n.set(p,e,null)}}},n.push=function(p,e){var f=n.get(p,e);A(f)||(f=[],n.set(p,e,f)),f.push.apply(f,Array.prototype.slice.call(arguments,2))},n.coalesce=function(p,e,f){for(var y,w=0,E=e.length;w<E;w++)if((y=n.get(p,e[w]))!==void 0)return y;return f},n.get=function(p,e,f){if(typeof e=="number"&&(e=[e]),!e||e.length===0)return p;if(p==null)return f;if(typeof e=="string")return n.get(p,e.split("."),f);var y=d(e[0]),w=x(p,y);return w===void 0?f:e.length===1?w:n.get(p[y],e.slice(1),f)},n.del=function(e,f){if(typeof f=="number"&&(f=[f]),e==null||u(f))return e;if(typeof f=="string")return n.del(e,f.split("."));var y=d(f[0]);if(x(e,y),!l(e,y))return e;if(f.length===1)A(e)?e.splice(y,1):delete e[y];else return n.del(e[y],f.slice(1));return e},n}var c=i();return c.create=i,c.withInheritedProps=i({includeInheritedProps:!0}),c})});var J=Z((bn,tr)=>{"use strict";tr.exports=gr;function k(r){return r instanceof Buffer?Buffer.from(r):new r.constructor(r.buffer.slice(),r.byteOffset,r.length)}function gr(r){if(r=r||{},r.circles)return Hr(r);let t=new Map;if(t.set(Date,a=>new Date(a)),t.set(Map,(a,d)=>new Map(s(Array.from(a),d))),t.set(Set,(a,d)=>new Set(s(Array.from(a),d))),r.constructorHandlers)for(let a of r.constructorHandlers)t.set(a[0],a[1]);let u=null;return r.proto?A:b;function s(a,d){let i=Object.keys(a),c=new Array(i.length);for(let o=0;o<i.length;o++){let n=i[o],l=a[n];typeof l!="object"||l===null?c[n]=l:l.constructor!==Object&&(u=t.get(l.constructor))?c[n]=u(l,d):ArrayBuffer.isView(l)?c[n]=k(l):c[n]=d(l)}return c}function b(a){if(typeof a!="object"||a===null)return a;if(Array.isArray(a))return s(a,b);if(a.constructor!==Object&&(u=t.get(a.constructor)))return u(a,b);let d={};for(let i in a){if(Object.hasOwnProperty.call(a,i)===!1)continue;let c=a[i];typeof c!="object"||c===null?d[i]=c:c.constructor!==Object&&(u=t.get(c.constructor))?d[i]=u(c,b):ArrayBuffer.isView(c)?d[i]=k(c):d[i]=b(c)}return d}function A(a){if(typeof a!="object"||a===null)return a;if(Array.isArray(a))return s(a,A);if(a.constructor!==Object&&(u=t.get(a.constructor)))return u(a,A);let d={};for(let i in a){let c=a[i];typeof c!="object"||c===null?d[i]=c:c.constructor!==Object&&(u=t.get(c.constructor))?d[i]=u(c,A):ArrayBuffer.isView(c)?d[i]=k(c):d[i]=A(c)}return d}}function Hr(r){let t=[],u=[],s=new Map;if(s.set(Date,i=>new Date(i)),s.set(Map,(i,c)=>new Map(A(Array.from(i),c))),s.set(Set,(i,c)=>new Set(A(Array.from(i),c))),r.constructorHandlers)for(let i of r.constructorHandlers)s.set(i[0],i[1]);let b=null;return r.proto?d:a;function A(i,c){let o=Object.keys(i),n=new Array(o.length);for(let l=0;l<o.length;l++){let S=o[l],x=i[S];if(typeof x!="object"||x===null)n[S]=x;else if(x.constructor!==Object&&(b=s.get(x.constructor)))n[S]=b(x,c);else if(ArrayBuffer.isView(x))n[S]=k(x);else{let I=t.indexOf(x);I!==-1?n[S]=u[I]:n[S]=c(x)}}return n}function a(i){if(typeof i!="object"||i===null)return i;if(Array.isArray(i))return A(i,a);if(i.constructor!==Object&&(b=s.get(i.constructor)))return b(i,a);let c={};t.push(i),u.push(c);for(let o in i){if(Object.hasOwnProperty.call(i,o)===!1)continue;let n=i[o];if(typeof n!="object"||n===null)c[o]=n;else if(n.constructor!==Object&&(b=s.get(n.constructor)))c[o]=b(n,a);else if(ArrayBuffer.isView(n))c[o]=k(n);else{let l=t.indexOf(n);l!==-1?c[o]=u[l]:c[o]=a(n)}}return t.pop(),u.pop(),c}function d(i){if(typeof i!="object"||i===null)return i;if(Array.isArray(i))return A(i,d);if(i.constructor!==Object&&(b=s.get(i.constructor)))return b(i,d);let c={};t.push(i),u.push(c);for(let o in i){let n=i[o];if(typeof n!="object"||n===null)c[o]=n;else if(n.constructor!==Object&&(b=s.get(n.constructor)))c[o]=b(n,d);else if(ArrayBuffer.isView(n))c[o]=k(n);else{let l=t.indexOf(n);l!==-1?c[o]=u[l]:c[o]=d(n)}}return t.pop(),u.pop(),c}}});var sn={};Gr(sn,{deepContains:()=>Br,defaults:()=>jr,version:()=>yn});var W=G(rr(),1);var ir=G(J(),1);var nr=G(J(),1);var hn=(0,nr.default)();function er(r){if(r==null||typeof r!="object")return!1;let t=Object.getPrototypeOf(r);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null?!1:!(Symbol.iterator in r)&&!(Symbol.toStringTag in r)}function g(r){if(r.includes(".")){let t=r.lastIndexOf(".");if(!r.slice(0,t).includes("."))return r.slice(0,t);for(let u=t-1;u--;)if(r[u]===".")return r.slice(u+1,t)}return null}var H=(0,ir.default)();function or(r,t){let u={now:!1};function s(b,A,a,d){let i=H(b),c,o=T({depth:-1,path:""},a);if(o.depth+=1,Array.isArray(i))for(let n=0,l=i.length;n<l&&!d.now;n++){let S=o.path?"".concat(o.path,".").concat(n):"".concat(n);i[n]!==void 0?(o.parent=H(i),o.parentType="array",o.parentKey=g(S),c=s(A(i[n],void 0,B(T({},o),{path:S}),d),A,B(T({},o),{path:S}),d),Number.isNaN(c)&&n<i.length?(i.splice(n,1),n-=1):i[n]=c):i.splice(n,1)}else if(er(i))for(let n in i){if(d.now&&n!=null)break;let l=o.path?"".concat(o.path,".").concat(n):n;o.depth===0&&n!=null&&(o.topmostKey=n),o.parent=H(i),o.parentType="object",o.parentKey=g(l),c=s(A(n,i[n],B(T({},o),{path:l}),d),A,B(T({},o),{path:l}),d),Number.isNaN(c)?delete i[n]:i[n]=c}return i}return s(r,t,{},u)}function ur(r){return Object.keys(r)}var fr=["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function Kr(r){return fr.includes(r)}var pr=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Blob","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","WeakRef","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","FormData","URLSearchParams","HTMLElement","NaN",...fr];function _r(r){return pr.includes(r)}var yr=["null","undefined","string","number","bigint","boolean","symbol"];function Qr(r){return yr.includes(r)}var Nn=["positive number","negative number","Class","string with a number","null or undefined","Iterable","AsyncIterable","native Promise","EnumCase","string with a URL","truthy","falsy","primitive","integer","plain object","TypedArray","array-like","tuple-like","Node.js Stream","infinite number","empty array","non-empty array","empty string","empty string or whitespace","non-empty string","non-empty string and not whitespace","empty object","non-empty object","empty set","non-empty set","empty map","non-empty map","PropertyKey","even integer","odd integer","T","in range","predicate returns truthy for any value","predicate returns truthy for all values","valid Date","valid length","whitespace string",...pr,...yr],h=r=>{let t=Object.prototype.toString.call(r).slice(8,-1);if(/HTML\w+Element/.test(t)&&Er(r))return"HTMLElement";if(_r(t))return t};function cr(r){if(r===null)return"null";switch(typeof r){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(r)?"NaN":"number";case"boolean":return"boolean";case"function":return"Function";case"bigint":return"bigint";case"symbol":return"symbol";default:}if(_(r))return"Observable";if(D(r))return"Array";if(hr(r))return"Buffer";let t=h(r);if(t&&t!=="Object")return t;if(ar(r))return"Promise";if(r instanceof String||r instanceof Boolean||r instanceof Number)throw new TypeError("Please don't use object wrappers for primitive types");return"Object"}function ar(r){return $(r==null?void 0:r.then)&&$(r==null?void 0:r.catch)}var qr=Object.assign(cr,{all:zr,any:dr,array:D,arrayBuffer:Zr,arrayLike:Xr,asyncFunction:vr,asyncGenerator:rt,asyncGeneratorFunction:tt,asyncIterable:br,bigint:nt,bigInt64Array:et,bigUint64Array:it,blob:ot,boolean:ut,boundFunction:ct,buffer:hr,class:ft,dataView:pt,date:wr,detect:cr,directInstanceOf:yt,emptyArray:at,emptyMap:lt,emptyObject:st,emptySet:dt,emptyString:Ar,emptyStringOrWhitespace:K,enumCase:bt,error:ht,evenInteger:wt,falsy:At,float32Array:Et,float64Array:xt,formData:St,function:$,generator:$t,generatorFunction:Ot,htmlElement:Er,infinite:mt,inRange:It,int16Array:Dt,int32Array:kt,int8Array:Ft,integer:xr,iterable:Sr,map:P,nan:$r,nativePromise:Or,negativeNumber:jt,nodeStream:Bt,nonEmptyArray:Pt,nonEmptyMap:Ct,nonEmptyObject:Ut,nonEmptySet:Vt,nonEmptyString:Mt,nonEmptyStringAndNotWhitespace:Rt,null:L,nullOrUndefined:Tr,number:C,numericString:Lt,object:U,observable:_,oddInteger:Wt,plainObject:Nr,positiveNumber:Gt,primitive:Jt,promise:gt,propertyKey:Ht,regExp:Kt,safeInteger:mr,set:V,sharedArrayBuffer:_t,string:N,symbol:Ir,truthy:Qt,tupleLike:qt,typedArray:zt,uint16Array:Yt,uint32Array:Zt,uint8Array:Xt,uint8ClampedArray:vt,undefined:Q,urlInstance:rn,urlSearchParams:tn,urlString:nn,optional:Yr,validDate:en,validLength:Dr,weakMap:on,weakRef:un,weakSet:cn,whitespaceString:kr});function lr(r){return t=>xr(t)&&Math.abs(t%2)===r}function sr(r,t){if(r.length===0){if(!t)throw new TypeError("Invalid predicate array");return}for(let u of r)if(!$(u))throw new TypeError("Invalid predicate: ".concat(JSON.stringify(u)))}function zr(r,...t){if(Array.isArray(r)){let u=r;sr(u,t.length===0);let s=b=>u.every(A=>A(b));return t.length===0?s:R(Array.prototype.every,s,t)}return R(Array.prototype.every,r,t)}function dr(r,...t){if(Array.isArray(r)){let u=r;sr(u,t.length===0);let s=b=>u.some(A=>A(b));return t.length===0?s:R(Array.prototype.some,s,t)}return R(Array.prototype.some,r,t)}function Yr(r,t){return Q(r)||t(r)}function D(r,t){return Array.isArray(r)?$(t)?r.every(u=>t(u)):!0:!1}function Zr(r){return h(r)==="ArrayBuffer"}function Xr(r){return!Tr(r)&&!$(r)&&Dr(r.length)}function vr(r){return h(r)==="AsyncFunction"}function rt(r){return br(r)&&$(r.next)&&$(r.throw)}function tt(r){return h(r)==="AsyncGeneratorFunction"}function br(r){return $(r==null?void 0:r[Symbol.asyncIterator])}function nt(r){return typeof r=="bigint"}function et(r){return h(r)==="BigInt64Array"}function it(r){return h(r)==="BigUint64Array"}function ot(r){return h(r)==="Blob"}function ut(r){return r===!0||r===!1}function ct(r){return $(r)&&!Object.hasOwn(r,"prototype")}function hr(r){var t,u,s;return(s=(u=(t=r==null?void 0:r.constructor)==null?void 0:t.isBuffer)==null?void 0:u.call(t,r))!=null?s:!1}function ft(r){return $(r)&&/^class(\s+|{)/.test(r.toString())}function pt(r){return h(r)==="DataView"}function wr(r){return h(r)==="Date"}function yt(r,t){return r==null?!1:Object.getPrototypeOf(r)===t.prototype}function at(r){return D(r)&&r.length===0}function lt(r){return P(r)&&r.size===0}function st(r){return U(r)&&!P(r)&&!V(r)&&Object.keys(r).length===0}function dt(r){return V(r)&&r.size===0}function Ar(r){return N(r)&&r.length===0}function K(r){return Ar(r)||kr(r)}function bt(r,t){return Object.values(t).includes(r)}function ht(r){return h(r)==="Error"}function wt(r){return lr(0)(r)}function At(r){return!r}function Et(r){return h(r)==="Float32Array"}function xt(r){return h(r)==="Float64Array"}function St(r){return h(r)==="FormData"}function $(r){return typeof r=="function"}function $t(r){return Sr(r)&&$(r==null?void 0:r.next)&&$(r==null?void 0:r.throw)}function Ot(r){return h(r)==="GeneratorFunction"}var Tt=1,Nt=["innerHTML","ownerDocument","style","attributes","nodeValue"];function Er(r){return U(r)&&r.nodeType===Tt&&N(r.nodeName)&&!Nr(r)&&Nt.every(t=>t in r)}function mt(r){return r===Number.POSITIVE_INFINITY||r===Number.NEGATIVE_INFINITY}function It(r,t){if(C(t))return r>=Math.min(0,t)&&r<=Math.max(t,0);if(D(t)&&t.length===2)return r>=Math.min(...t)&&r<=Math.max(...t);throw new TypeError("Invalid range: ".concat(JSON.stringify(t)))}function Dt(r){return h(r)==="Int16Array"}function kt(r){return h(r)==="Int32Array"}function Ft(r){return h(r)==="Int8Array"}function xr(r){return Number.isInteger(r)}function Sr(r){return $(r==null?void 0:r[Symbol.iterator])}function P(r){return h(r)==="Map"}function $r(r){return Number.isNaN(r)}function Or(r){return h(r)==="Promise"}function jt(r){return C(r)&&r<0}function Bt(r){return U(r)&&$(r.pipe)&&!_(r)}function Pt(r){return D(r)&&r.length>0}function Ct(r){return P(r)&&r.size>0}function Ut(r){return U(r)&&!P(r)&&!V(r)&&Object.keys(r).length>0}function Vt(r){return V(r)&&r.size>0}function Mt(r){return N(r)&&r.length>0}function Rt(r){return N(r)&&!K(r)}function L(r){return r===null}function Tr(r){return L(r)||Q(r)}function C(r){return typeof r=="number"&&!Number.isNaN(r)}function Lt(r){return N(r)&&!K(r)&&!Number.isNaN(Number(r))}function U(r){return!L(r)&&(typeof r=="object"||$(r))}function _(r){var t,u;return r?Symbol.observable!==void 0&&r===((t=r[Symbol.observable])==null?void 0:t.call(r))||r===((u=r["@@observable"])==null?void 0:u.call(r)):!1}function Wt(r){return lr(1)(r)}function Nr(r){if(typeof r!="object"||r===null)return!1;let t=Object.getPrototypeOf(r);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in r)&&!(Symbol.iterator in r)}function Gt(r){return C(r)&&r>0}function Jt(r){return L(r)||Qr(typeof r)}function gt(r){return Or(r)||ar(r)}function Ht(r){return dr([N,C,Ir],r)}function Kt(r){return h(r)==="RegExp"}function mr(r){return Number.isSafeInteger(r)}function V(r){return h(r)==="Set"}function _t(r){return h(r)==="SharedArrayBuffer"}function N(r){return typeof r=="string"}function Ir(r){return typeof r=="symbol"}function Qt(r){return!!r}function qt(r,t){return D(t)&&D(r)&&t.length===r.length?t.every((u,s)=>u(r[s])):!1}function zt(r){return Kr(h(r))}function Yt(r){return h(r)==="Uint16Array"}function Zt(r){return h(r)==="Uint32Array"}function Xt(r){return h(r)==="Uint8Array"}function vt(r){return h(r)==="Uint8ClampedArray"}function Q(r){return r===void 0}function rn(r){return h(r)==="URL"}function tn(r){return h(r)==="URLSearchParams"}function nn(r){if(!N(r))return!1;try{return new URL(r),!0}catch(t){return!1}}function en(r){return wr(r)&&!$r(Number(r))}function Dr(r){return mr(r)&&r>=0}function on(r){return h(r)==="WeakMap"}function un(r){return h(r)==="WeakRef"}function cn(r){return h(r)==="WeakSet"}function kr(r){return N(r)&&/^\s+$/.test(r)}function R(r,t,u){if(!$(t))throw new TypeError("Invalid predicate: ".concat(JSON.stringify(t)));if(u.length===0)throw new TypeError("Invalid number of values");return r.call(u,t)}var mn=new Intl.ListFormat("en",{style:"long",type:"conjunction"}),In=new Intl.ListFormat("en",{style:"long",type:"disjunction"});var fn={isArray:"Array",isArrayBuffer:"ArrayBuffer",isArrayLike:"array-like",isAsyncFunction:"AsyncFunction",isAsyncGenerator:"AsyncGenerator",isAsyncGeneratorFunction:"AsyncGeneratorFunction",isAsyncIterable:"AsyncIterable",isBigint:"bigint",isBigInt64Array:"BigInt64Array",isBigUint64Array:"BigUint64Array",isBlob:"Blob",isBoolean:"boolean",isBoundFunction:"Function",isBuffer:"Buffer",isClass:"Class",isDataView:"DataView",isDate:"Date",isDirectInstanceOf:"T",isEmptyArray:"empty array",isEmptyMap:"empty map",isEmptyObject:"empty object",isEmptySet:"empty set",isEmptyString:"empty string",isEmptyStringOrWhitespace:"empty string or whitespace",isEnumCase:"EnumCase",isError:"Error",isEvenInteger:"even integer",isFalsy:"falsy",isFloat32Array:"Float32Array",isFloat64Array:"Float64Array",isFormData:"FormData",isFunction:"Function",isGenerator:"Generator",isGeneratorFunction:"GeneratorFunction",isHtmlElement:"HTMLElement",isInfinite:"infinite number",isInRange:"in range",isInt16Array:"Int16Array",isInt32Array:"Int32Array",isInt8Array:"Int8Array",isInteger:"integer",isIterable:"Iterable",isMap:"Map",isNan:"NaN",isNativePromise:"native Promise",isNegativeNumber:"negative number",isNodeStream:"Node.js Stream",isNonEmptyArray:"non-empty array",isNonEmptyMap:"non-empty map",isNonEmptyObject:"non-empty object",isNonEmptySet:"non-empty set",isNonEmptyString:"non-empty string",isNonEmptyStringAndNotWhitespace:"non-empty string and not whitespace",isNull:"null",isNullOrUndefined:"null or undefined",isNumber:"number",isNumericString:"string with a number",isObject:"Object",isObservable:"Observable",isOddInteger:"odd integer",isPlainObject:"plain object",isPositiveNumber:"positive number",isPrimitive:"primitive",isPromise:"Promise",isPropertyKey:"PropertyKey",isRegExp:"RegExp",isSafeInteger:"integer",isSet:"Set",isSharedArrayBuffer:"SharedArrayBuffer",isString:"string",isSymbol:"symbol",isTruthy:"truthy",isTupleLike:"tuple-like",isTypedArray:"TypedArray",isUint16Array:"Uint16Array",isUint32Array:"Uint32Array",isUint8Array:"Uint8Array",isUint8ClampedArray:"Uint8ClampedArray",isUndefined:"undefined",isUrlInstance:"URL",isUrlSearchParams:"URLSearchParams",isUrlString:"string with a URL",isValidDate:"valid Date",isValidLength:"valid length",isWeakMap:"WeakMap",isWeakRef:"WeakRef",isWeakSet:"WeakSet",isWhitespaceString:"whitespace string"},Dn=ur(fn);var m=qr;var Fr="5.1.3";var yn=Fr;function an(r){if(r.includes(".")){for(let t=r.length;t--;)if(r[t]===".")return r.slice(0,t)}return r}function ln(r,t){return Array.from(r).filter((u,s)=>s!==t)}var jr={skipContainers:!0,arrayStrictComparison:!1};function Br(r,t,u,s,b){let A=T(T({},jr),b);m(r)!==m(t)?s("the first input arg is of a type ".concat(m(r).toLowerCase()," but the second is ").concat(m(t).toLowerCase(),". Values are - 1st:\n").concat(JSON.stringify(r,null,4),"\n2nd:\n").concat(JSON.stringify(t,null,4))):or(t,(a,d,i,c)=>{let o=d!==void 0?d:a,{path:n}=i;if(W.default.has(r,n))if(!A.arrayStrictComparison&&m.plainObject(o)&&i.parentType==="array"&&i.parent.length>1){c.now=!0;let l=Array.from(i.path.includes(".")?W.default.get(r,an(n)):r);if(l.length<i.parent.length)s("the first array: ".concat(JSON.stringify(l,null,4),"\nhas less objects than array we're matching against, ").concat(JSON.stringify(i.parent,null,4)));else{let S=i.parent,x=l.map((y,w)=>w),I=S.map((y,w)=>w),p=[];for(let y=0,w=x.length;y<w;y++){let E=[],O=x[y],F=ln(x,y);E.push(O),F.forEach(Pr=>{p.push(Array.from(E).concat(Pr))})}let e=p.map(y=>y.map((w,E)=>[E,w])),f=0;for(let y=0,w=e.length;y<w;y++){let E=0;e[y].forEach(O=>{m.plainObject(S[O[0]])&&m.plainObject(l[O[1]])&&Object.keys(S[O[0]]).forEach(F=>{Object.keys(l[O[1]]).includes(F)&&(E+=1,l[O[1]][F]===S[O[0]][F]&&(E+=5))})}),e[y].push(E),E>f&&(f=E)}for(let y=0,w=e.length;y<w;y++)if(e[y][2]===f){e[y].forEach((E,O)=>{O<e[y].length-1&&Br(l[E[1]],S[E[0]],u,s,A)});break}}}else{let l=W.default.get(r,n);(!A.skipContainers||!m.plainObject(l)&&!Array.isArray(l))&&u(l,o,n)}else s("the first input: ".concat(JSON.stringify(r,null,4),'\ndoes not have the path "').concat(n,'", we were looking, would it contain a value ').concat(JSON.stringify(o,null,0),"."));return o})}return Jr(sn);})();
|
|
10
|
+
"use strict";var astDeepContains=(()=>{var K=Object.create;var S=Object.defineProperty,H=Object.defineProperties,Q=Object.getOwnPropertyDescriptor,G=Object.getOwnPropertyDescriptors,z=Object.getOwnPropertyNames,W=Object.getOwnPropertySymbols,Y=Object.getPrototypeOf,T=Object.prototype.hasOwnProperty,Z=Object.prototype.propertyIsEnumerable;var N=(e,r,l)=>r in e?S(e,r,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[r]=l,$=(e,r)=>{for(var l in r||(r={}))T.call(r,l)&&N(e,l,r[l]);if(W)for(var l of W(r))Z.call(r,l)&&N(e,l,r[l]);return e},C=(e,r)=>H(e,G(r));var q=(e,r)=>()=>{try{return r||e((r={exports:{}}).exports,r),r.exports}catch(l){throw r=0,l}},X=(e,r)=>{for(var l in r)S(e,l,{get:r[l],enumerable:!0})},M=(e,r,l,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let g of z(r))!T.call(e,g)&&g!==l&&S(e,g,{get:()=>r[g],enumerable:!(a=Q(r,g))||a.enumerable});return e};var ee=(e,r,l)=>(l=e!=null?K(Y(e)):{},M(r||!e||!e.__esModule?S(l,"default",{value:e,enumerable:!0}):l,e)),te=e=>M(S({},"__esModule",{value:!0}),e);var x=(e,r,l)=>N(e,typeof r!="symbol"?r+"":r,l);var V=q((L,I)=>{(function(e,r){"use strict";typeof I=="object"&&typeof I.exports=="object"?I.exports=r():typeof define=="function"&&define.amd?define([],r):e.objectPath=r()})(L,function(){"use strict";var e=Object.prototype.toString;function r(n,i){return n==null?!1:Object.prototype.hasOwnProperty.call(n,i)}function l(n){if(!n||u(n)&&n.length===0)return!0;if(typeof n!="string"){for(var i in n)if(r(n,i))return!1;return!0}return!1}function a(n){return e.call(n)}function g(n){return typeof n=="object"&&a(n)==="[object Object]"}var u=Array.isArray||function(n){return e.call(n)==="[object Array]"};function m(n){return typeof n=="boolean"||a(n)==="[object Boolean]"}function p(n){var i=parseInt(n);return i.toString()===n?i:n}function c(n){n=n||{};var i=function(o){return Object.keys(i).reduce(function(t,s){return s==="create"||typeof i[s]=="function"&&(t[s]=i[s].bind(i,o)),t},{})},y;n.includeInheritedProps?y=function(){return!0}:y=function(o,t){return typeof t=="number"&&Array.isArray(o)||r(o,t)};function b(o,t){if(y(o,t))return o[t]}var d;n.includeInheritedProps?d=function(o,t){typeof t!="string"&&typeof t!="number"&&(t=String(t));var s=b(o,t);if(t==="__proto__"||t==="prototype"||t==="constructor"&&typeof s=="function")throw new Error("For security reasons, object's magic properties cannot be set");return s}:d=function(o,t){return b(o,t)};function v(o,t,s,f){if(typeof t=="number"&&(t=[t]),!t||t.length===0)return o;if(typeof t=="string")return v(o,t.split(".").map(p),s,f);var w=t[0],k=d(o,w);return t.length===1?((k===void 0||!f)&&(o[w]=s),k):(k===void 0&&(typeof t[1]=="number"?o[w]=[]:o[w]={}),v(o[w],t.slice(1),s,f))}return i.has=function(o,t){if(typeof t=="number"?t=[t]:typeof t=="string"&&(t=t.split(".")),!t||t.length===0)return!!o;for(var s=0;s<t.length;s++){var f=p(t[s]);if(typeof f=="number"&&u(o)&&f<o.length||(n.includeInheritedProps?f in Object(o):r(o,f)))o=o[f];else return!1}return!0},i.ensureExists=function(o,t,s){return v(o,t,s,!0)},i.set=function(o,t,s,f){return v(o,t,s,f)},i.insert=function(o,t,s,f){var w=i.get(o,t);f=~~f,u(w)||(w=[],i.set(o,t,w)),w.splice(f,0,s)},i.empty=function(o,t){if(!l(t)&&o!=null){var s,f;if(s=i.get(o,t)){if(typeof s=="string")return i.set(o,t,"");if(m(s))return i.set(o,t,!1);if(typeof s=="number")return i.set(o,t,0);if(u(s))s.length=0;else if(g(s))for(f in s)y(s,f)&&delete s[f];else return i.set(o,t,null)}}},i.push=function(o,t){var s=i.get(o,t);u(s)||(s=[],i.set(o,t,s)),s.push.apply(s,Array.prototype.slice.call(arguments,2))},i.coalesce=function(o,t,s){for(var f,w=0,k=t.length;w<k;w++)if((f=i.get(o,t[w]))!==void 0)return f;return s},i.get=function(o,t,s){if(typeof t=="number"&&(t=[t]),!t||t.length===0)return o;if(o==null)return s;if(typeof t=="string")return i.get(o,t.split("."),s);var f=p(t[0]),w=d(o,f);return w===void 0?s:t.length===1?w:i.get(o[f],t.slice(1),s)},i.del=function(t,s){if(typeof s=="number"&&(s=[s]),t==null||l(s))return t;if(typeof s=="string")return i.del(t,s.split("."));var f=p(s[0]);if(d(t,f),!y(t,f))return t;if(s.length===1)u(t)?t.splice(f,1):delete t[f];else return i.del(t[f],s.slice(1));return t},i}var h=c();return h.create=c,h.withInheritedProps=c({includeInheritedProps:!0}),h})});var fe={};X(fe,{deepContains:()=>_,defaults:()=>J,version:()=>se});var pe=new Set([..."\u060B$\u20BC\u17DB\xA5\u20A1\u20B1\xA3\u20AC\xA2\u20B9\uFDFC\u20AA\u20A9\u20AD\u20A8\u20AE\u20A6\u20BD\u20AB\u0E3F\u20A9\u20BA\u20B4","$U","$b","B/.","BZ$","Br","Bs","C$","CHF","Ft","Gs","J$","KM","K\u010D","L","MT","NT$","P","Q","R","R$","RD$","RM","Rp","S","S/.","TT$","Z$","kn","kr","lei","z\u0142","\u0192","\u0414\u0438\u043D.","\u0434\u0435\u043D","\u043B\u0432","\u062F.\u0625","Lek"]);var re=class{constructor(){x(this,"hasRepeatedReferences",!1);x(this,"clones",[]);x(this,"index");x(this,"sources",[])}get(e){if(this.index){let l=this.index.get(e);return l!==void 0&&(this.hasRepeatedReferences=!0),l}let r=this.sources.indexOf(e);if(r!==-1)return this.hasRepeatedReferences=!0,this.clones[r]}set(e,r){if(this.index){this.index.set(e,r);return}if(this.sources.push(e),this.clones.push(r),this.sources.length===32){this.index=new WeakMap;for(let l=0;l<this.sources.length;l++)this.index.set(this.sources[l],this.clones[l]);this.sources=[],this.clones=[]}}};function j(e,r){let l=r.get(e);if(l!==void 0)return l;let a=e.slice(0);return r.set(e,a),a}function ne(e,r){if(typeof Buffer<"u"&&Buffer.isBuffer(e)){let u=Buffer.from(e);return r.set(e,u),u}let l=j(e.buffer,r);if(e instanceof DataView){let u=new DataView(l,e.byteOffset,e.byteLength);return r.set(e,u),u}let a=e.constructor,g=new a(l,e.byteOffset,e.length);return r.set(e,g),g}function P(e,r,l,a){for(let g of l){let u=r[g];e[g]=typeof u!="object"||u===null?u:A(u,a)}}function A(e,r){if(typeof e!="object"||e===null)return e;let l=r.get(e);if(l!==void 0)return l;if(Array.isArray(e)){let u=e.length,m=new Array(u);r.set(e,m);let p=e,c=Object.keys(e);if(c.length===u&&(u===0||c[u-1]==="".concat(u-1)))for(let h=0;h<u;h++){let n=p[h];m[h]=typeof n!="object"||n===null?n:A(n,r)}else P(m,p,c,r);return m}let a=Object.getPrototypeOf(e);if(a===Object.prototype||a===null){let u={};return r.set(e,u),P(u,e,Object.keys(e),r),u}if(e instanceof Date){let u=new Date(e.getTime());return r.set(e,u),u}if(ArrayBuffer.isView(e))return ne(e,r);if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return j(e,r);if(e instanceof Map){let u=new Map;r.set(e,u);for(let[m,p]of e)u.set(A(m,r),A(p,r));return u}if(e instanceof Set){let u=new Set;r.set(e,u);for(let m of e)u.add(A(m,r));return u}let g={};return r.set(e,g),P(g,e,Object.keys(e),r),g}function O(e){return A(e,new re)}function B(e){if(e==null||typeof e!="object")return!1;let r=Object.getPrototypeOf(e);return r!==null&&r!==Object.prototype&&Object.getPrototypeOf(r)!==null?!1:!(Symbol.iterator in e)&&!(Symbol.toStringTag in e)}function R(e,r){if(typeof r!="function")throw new TypeError("ast-monkey-traverse/traverse(): [THROW_ID_01] The second argument must be a callback function. It was ".concat(typeof r,"."));let l={now:!1};function a(g,u,m,p){let c=g,h,n=$({depth:-1,path:""},m);if(n.depth+=1,Array.isArray(c))for(let i=0,y=c.length;i<y&&!p.now;i++){let b=n.path?"".concat(n.path,".").concat(i):"".concat(i);if(c[i]!==void 0){n.parent=O(c),n.parentType="array",n.parentKey=n.path?n.path.slice(n.path.lastIndexOf(".")+1):null;let d=c[i],v=u(d,void 0,C($({},n),{path:b}),p);h=a(v===d?v:O(v),u,C($({},n),{path:b}),p),Number.isNaN(h)&&i<c.length?(c.splice(i,1),i-=1):c[i]=h}else c.splice(i,1)}else if(B(c))for(let i in c){if(p.now&&i!=null)break;let y=n.path?"".concat(n.path,".").concat(i):i;n.depth===0&&i!=null&&(n.topmostKey=i),n.parent=O(c),n.parentType="object",n.parentKey=n.path?n.path.slice(n.path.lastIndexOf(".")+1):null;let b=c[i],d=u(i,b,C($({},n),{path:y}),p);h=a(d===b?d:O(d),u,C($({},n),{path:y}),p),Number.isNaN(h)?delete c[i]:c[i]=h}return c}return a(O(e),r,{},l)}var D=ee(V(),1);var U="5.2.1";var se=U;function oe(e){if(e.includes(".")){for(let r=e.length;r--;)if(e[r]===".")return e.slice(0,r)}return e}function E(e){if(e===null||typeof e!="object")return!1;let r=Object.getPrototypeOf(e);return r===null||r===Object.prototype}function F(e){return e===null?"null":Array.isArray(e)?"array":typeof e=="number"&&Number.isNaN(e)?"nan":typeof e!="object"?typeof e:Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}var J={skipContainers:!0,arrayStrictComparison:!1};function _(e,r,l,a,g){let u=$($({},J),g),m=F(e),p=F(r);m!==p?a("the first input arg is of a type ".concat(m," but the second is ").concat(p,". Values are - 1st:\n").concat(JSON.stringify(e,null,4),"\n2nd:\n").concat(JSON.stringify(r,null,4))):R(r,(c,h,n,i)=>{let y=h!==void 0?h:c,{path:b}=n;if(D.default.has(e,b))if(!u.arrayStrictComparison&&E(y)&&n.parentType==="array"&&n.parent.length>1){i.now=!0;let d=Array.from(n.path.includes(".")?D.default.get(e,oe(b)):e);if(d.length<n.parent.length)a("the first array: ".concat(JSON.stringify(d,null,4),"\nhas less objects than array we're matching against, ").concat(JSON.stringify(n.parent,null,4)));else{let v=n.parent,o=ae(v,d);for(let[t,s]of o)_(d[s],v[t],l,a,u)}}else{let d=D.default.get(e,b);(!u.skipContainers||!E(d)&&!Array.isArray(d))&&l(d,y,b)}else a("the first input: ".concat(JSON.stringify(e,null,4),'\ndoes not have the path "').concat(b,'", we were looking, would it contain a value ').concat(JSON.stringify(y,null,0),"."));return y})}var le=Object.prototype.hasOwnProperty;function ue(e,r){if(!E(e)||!E(r))return 0;let l=0;for(let a of Object.keys(e))le.call(r,a)&&(l+=r[a]===e[a]?6:1);return l}function ae(e,r){let l=e.length,a=r.length,g=e.map(n=>r.map(i=>ue(n,i))),u=new Array(l+1).fill(0),m=new Array(a+1).fill(0),p=new Array(a+1).fill(0),c=new Array(a+1).fill(0);for(let n=1;n<=l;n++){p[0]=n;let i=0,y=new Array(a+1).fill(Number.POSITIVE_INFINITY),b=new Array(a+1).fill(!1);do{b[i]=!0;let d=p[i],v=Number.POSITIVE_INFINITY,o=0;for(let t=1;t<=a;t++){if(b[t])continue;let s=-g[d-1][t-1]-u[d]-m[t];s<y[t]&&(y[t]=s,c[t]=i),y[t]<v&&(v=y[t],o=t)}for(let t=0;t<=a;t++)b[t]?(u[p[t]]+=v,m[t]-=v):y[t]-=v;i=o}while(p[i]!==0);do{let d=c[i];p[i]=p[d],i=d}while(i!==0)}let h=new Array(l);for(let n=1;n<=a;n++)p[n]>0&&(h[p[n]-1]=n-1);return h.map((n,i)=>[i,n])}return te(fe);})();
|
|
11
11
|
/**
|
|
12
12
|
* @name codsen-utils
|
|
13
13
|
* @fileoverview Various utility functions
|
|
14
|
-
* @version 1.
|
|
14
|
+
* @version 1.8.0
|
|
15
15
|
* @author Roy Revelt
|
|
16
16
|
* @license MIT
|
|
17
17
|
* {@link https://codsen.com/os/codsen-utils/}
|
|
18
18
|
*/
|
|
19
|
-
/**
|
|
20
|
-
* @name ast-monkey-util
|
|
21
|
-
* @fileoverview Utility library of AST helper functions
|
|
22
|
-
* @version 3.1.3
|
|
23
|
-
* @author Roy Revelt
|
|
24
|
-
* @license MIT
|
|
25
|
-
* {@link https://codsen.com/os/ast-monkey-util/}
|
|
26
|
-
*/
|
|
27
19
|
/**
|
|
28
20
|
* @name ast-monkey-traverse
|
|
29
21
|
* @fileoverview Utility library to traverse AST
|
|
30
|
-
* @version 4.1
|
|
22
|
+
* @version 4.2.1
|
|
31
23
|
* @author Roy Revelt
|
|
32
24
|
* @license MIT
|
|
33
25
|
* {@link https://codsen.com/os/ast-monkey-traverse/}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ast-deep-contains",
|
|
3
|
-
"version": "5.1
|
|
3
|
+
"version": "5.2.1",
|
|
4
4
|
"description": "Like t.same assert on array of objects, where element order doesn't matter.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"array",
|
|
@@ -49,47 +49,45 @@
|
|
|
49
49
|
},
|
|
50
50
|
"types": "types/index.d.ts",
|
|
51
51
|
"scripts": {
|
|
52
|
-
"build": "node
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"dev": "DEV=true node '../../ops/scripts/esbuild.js' && npm run dts",
|
|
52
|
+
"build": "node ../../ops/scripts/esbuild.js && npm run dts",
|
|
53
|
+
"coverage": "c8 uvu test",
|
|
54
|
+
"dev": "node ../../ops/scripts/esbuild.js --dev && npm run dts",
|
|
56
55
|
"devtest": "c8 npm run unit && npm run examples && npm run lint",
|
|
57
|
-
"dts": "rollup -c &&
|
|
56
|
+
"dts": "rollup -c && biome format --write --config-path=../../biome.json --vcs-enabled=false --use-editorconfig=false types/index.d.ts",
|
|
58
57
|
"examples": "node '../../ops/scripts/run-examples.js'",
|
|
59
|
-
"lect": "node '../../ops/lect/lect.js'
|
|
60
|
-
"
|
|
61
|
-
"lint": "
|
|
58
|
+
"lect": "node '../../ops/lect/lect.js'",
|
|
59
|
+
"lect:check": "node '../../ops/lect/lect.js' --check",
|
|
60
|
+
"lint": "biome lint --error-on-warnings . && npm run typecheck",
|
|
61
|
+
"lint:fix": "biome lint --write --error-on-warnings . && npm run typecheck",
|
|
62
62
|
"perf": "node perf/check.js",
|
|
63
63
|
"prep": "echo 'ready'",
|
|
64
|
-
"prettier": "
|
|
65
|
-
"prettier:format": "
|
|
66
|
-
"pretest": "npm run lect && npm run build",
|
|
64
|
+
"prettier": "biome format",
|
|
65
|
+
"prettier:format": "biome format --write .",
|
|
66
|
+
"pretest": "npm run lect:check && npm run build",
|
|
67
67
|
"test": "npm run devtest",
|
|
68
|
+
"typecheck": "tsc --noEmit --pretty false --project tsconfig.json",
|
|
68
69
|
"unit": "uvu test"
|
|
69
70
|
},
|
|
70
|
-
"engines": {
|
|
71
|
-
"node": ">=14.18.0"
|
|
72
|
-
},
|
|
73
71
|
"c8": {
|
|
72
|
+
"all": true,
|
|
74
73
|
"check-coverage": true,
|
|
75
|
-
"exclude": [
|
|
76
|
-
|
|
77
|
-
],
|
|
74
|
+
"exclude": ["**/test/**/*.*"],
|
|
75
|
+
"include": ["dist/*.esm.js"],
|
|
78
76
|
"lines": 100
|
|
79
77
|
},
|
|
80
78
|
"lect": {
|
|
81
79
|
"licence": {
|
|
82
|
-
"extras": [
|
|
83
|
-
""
|
|
84
|
-
]
|
|
80
|
+
"extras": [""]
|
|
85
81
|
},
|
|
86
82
|
"various": {}
|
|
87
83
|
},
|
|
88
84
|
"dependencies": {
|
|
89
|
-
"
|
|
90
|
-
"ast-monkey-traverse": "^4.1.3",
|
|
85
|
+
"ast-monkey-traverse": "^4.2.1",
|
|
91
86
|
"object-path": "^0.11.8"
|
|
92
87
|
},
|
|
88
|
+
"engines": {
|
|
89
|
+
"node": ">=18.20.8"
|
|
90
|
+
},
|
|
93
91
|
"publishConfig": {
|
|
94
92
|
"registry": "https://registry.npmjs.org/"
|
|
95
93
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -4,12 +4,8 @@ interface Opts {
|
|
|
4
4
|
arrayStrictComparison: boolean;
|
|
5
5
|
}
|
|
6
6
|
declare const defaults: Opts;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
interface ErrorCallback {
|
|
11
|
-
(errStr: string): void;
|
|
12
|
-
}
|
|
7
|
+
type Callback = (leftSideVal: any, rightSideVal: any, path: string) => void;
|
|
8
|
+
type ErrorCallback = (errStr: string) => void;
|
|
13
9
|
/**
|
|
14
10
|
* Like t.same assert on array of objects, where element order doesn't matter.
|
|
15
11
|
*/
|