ast-deep-contains 5.2.0 → 5.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -3,12 +3,18 @@
|
|
|
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.2.2 (2026-08-22)
|
|
7
|
+
|
|
8
|
+
### Performance Improvements
|
|
9
|
+
|
|
10
|
+
- optimise package hot paths and JSON editing ([f3112bd](https://github.com/codsen/codsen/commit/f3112bd7fc0d7c9bc09312d3744c950691d72ca5))
|
|
11
|
+
|
|
6
12
|
## 5.2.0 (2026-08-19)
|
|
7
13
|
|
|
8
14
|
### Bug Fixes
|
|
9
15
|
|
|
10
16
|
- match every object in unordered arrays ([70e67d9](https://github.com/codsen/codsen/commit/70e67d9d786168ce986855ab2a53a76376a9152c))
|
|
11
|
-
- resolve review findings
|
|
17
|
+
- resolve various review findings ([b60e9ee](https://github.com/codsen/codsen/commit/b60e9eeb499af94685cfb87b4970fe025be1fc10))
|
|
12
18
|
- retire direct publish aliases ([f98e31e](https://github.com/codsen/codsen/commit/f98e31eb89bc185471225664e610b55f34fbf648))
|
|
13
19
|
|
|
14
20
|
### Features
|
|
@@ -1,13 +1,13 @@
|
|
|
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.2.
|
|
4
|
+
* @version 5.2.2
|
|
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{traverse as v}from"ast-monkey-traverse";import w from"object-path";var k="5.2.
|
|
10
|
+
import{traverse as v}from"ast-monkey-traverse";import w from"object-path";var k="5.2.2";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
11
|
${JSON.stringify(e,null,4)}
|
|
12
12
|
2nd:
|
|
13
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)}
|
|
@@ -1,17 +1,17 @@
|
|
|
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.2.
|
|
4
|
+
* @version 5.2.2
|
|
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 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.0";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);})();
|
|
10
|
+
"use strict";var astDeepContains=(()=>{var Q=Object.create;var k=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames,N=Object.getOwnPropertySymbols,Y=Object.getPrototypeOf,T=Object.prototype.hasOwnProperty,Z=Object.prototype.propertyIsEnumerable;var P=(e,r,l)=>r in e?k(e,r,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[r]=l,C=(e,r)=>{for(var l in r||(r={}))T.call(r,l)&&P(e,l,r[l]);if(N)for(var l of N(r))Z.call(r,l)&&P(e,l,r[l]);return e};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)k(e,l,{get:r[l],enumerable:!0})},R=(e,r,l,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let h of z(r))!T.call(e,h)&&h!==l&&k(e,h,{get:()=>r[h],enumerable:!(a=G(r,h))||a.enumerable});return e};var ee=(e,r,l)=>(l=e!=null?Q(Y(e)):{},R(r||!e||!e.__esModule?k(l,"default",{value:e,enumerable:!0}):l,e)),te=e=>R(k({},"__esModule",{value:!0}),e);var x=(e,r,l)=>P(e,typeof r!="symbol"?r+"":r,l);var F=q((U,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()})(U,function(){"use strict";var e=Object.prototype.toString;function r(o,n){return o==null?!1:Object.prototype.hasOwnProperty.call(o,n)}function l(o){if(!o||u(o)&&o.length===0)return!0;if(typeof o!="string"){for(var n in o)if(r(o,n))return!1;return!0}return!1}function a(o){return e.call(o)}function h(o){return typeof o=="object"&&a(o)==="[object Object]"}var u=Array.isArray||function(o){return e.call(o)==="[object Array]"};function v(o){return typeof o=="boolean"||a(o)==="[object Boolean]"}function c(o){var n=parseInt(o);return n.toString()===o?n:o}function w(o){o=o||{};var n=function(s){return Object.keys(n).reduce(function(t,i){return i==="create"||typeof n[i]=="function"&&(t[i]=n[i].bind(n,s)),t},{})},$;o.includeInheritedProps?$=function(){return!0}:$=function(s,t){return typeof t=="number"&&Array.isArray(s)||r(s,t)};function y(s,t){if($(s,t))return s[t]}var p;o.includeInheritedProps?p=function(s,t){typeof t!="string"&&typeof t!="number"&&(t=String(t));var i=y(s,t);if(t==="__proto__"||t==="prototype"||t==="constructor"&&typeof i=="function")throw new Error("For security reasons, object's magic properties cannot be set");return i}:p=function(s,t){return y(s,t)};function d(s,t,i,f){if(typeof t=="number"&&(t=[t]),!t||t.length===0)return s;if(typeof t=="string")return d(s,t.split(".").map(c),i,f);var m=t[0],g=p(s,m);return t.length===1?((g===void 0||!f)&&(s[m]=i),g):(g===void 0&&(typeof t[1]=="number"?s[m]=[]:s[m]={}),d(s[m],t.slice(1),i,f))}return n.has=function(s,t){if(typeof t=="number"?t=[t]:typeof t=="string"&&(t=t.split(".")),!t||t.length===0)return!!s;for(var i=0;i<t.length;i++){var f=c(t[i]);if(typeof f=="number"&&u(s)&&f<s.length||(o.includeInheritedProps?f in Object(s):r(s,f)))s=s[f];else return!1}return!0},n.ensureExists=function(s,t,i){return d(s,t,i,!0)},n.set=function(s,t,i,f){return d(s,t,i,f)},n.insert=function(s,t,i,f){var m=n.get(s,t);f=~~f,u(m)||(m=[],n.set(s,t,m)),m.splice(f,0,i)},n.empty=function(s,t){if(!l(t)&&s!=null){var i,f;if(i=n.get(s,t)){if(typeof i=="string")return n.set(s,t,"");if(v(i))return n.set(s,t,!1);if(typeof i=="number")return n.set(s,t,0);if(u(i))i.length=0;else if(h(i))for(f in i)$(i,f)&&delete i[f];else return n.set(s,t,null)}}},n.push=function(s,t){var i=n.get(s,t);u(i)||(i=[],n.set(s,t,i)),i.push.apply(i,Array.prototype.slice.call(arguments,2))},n.coalesce=function(s,t,i){for(var f,m=0,g=t.length;m<g;m++)if((f=n.get(s,t[m]))!==void 0)return f;return i},n.get=function(s,t,i){if(typeof t=="number"&&(t=[t]),!t||t.length===0)return s;if(s==null)return i;if(typeof t=="string")return n.get(s,t.split("."),i);var f=c(t[0]),m=p(s,f);return m===void 0?i:t.length===1?m:n.get(s[f],t.slice(1),i)},n.del=function(t,i){if(typeof i=="number"&&(i=[i]),t==null||l(i))return t;if(typeof i=="string")return n.del(t,i.split("."));var f=c(i[0]);if(p(t,f),!$(t,f))return t;if(i.length===1)u(t)?t.splice(f,1):delete t[f];else return n.del(t[f],i.slice(1));return t},n}var b=w();return b.create=w,b.withInheritedProps=w({includeInheritedProps:!0}),b})});var fe={};X(fe,{deepContains:()=>H,defaults:()=>K,version:()=>oe});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 B(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=B(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,h=new a(l,e.byteOffset,e.length);return r.set(e,h),h}function j(e,r,l,a){for(let h of l){let u=r[h];e[h]=typeof u!="object"||u===null?u:S(u,a)}}function S(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,v=new Array(u);r.set(e,v);let c=e,w=Object.keys(e);if(w.length===u&&(u===0||w[u-1]==="".concat(u-1)))for(let b=0;b<u;b++){let o=c[b];v[b]=typeof o!="object"||o===null?o:S(o,r)}else j(v,c,w,r);return v}let a=Object.getPrototypeOf(e);if(a===Object.prototype||a===null){let u={};return r.set(e,u),j(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 B(e,r);if(e instanceof Map){let u=new Map;r.set(e,u);for(let[v,c]of e)u.set(S(v,r),S(c,r));return u}if(e instanceof Set){let u=new Set;r.set(e,u);for(let v of e)u.add(S(v,r));return u}let h={};return r.set(e,h),j(h,e,Object.keys(e),r),h}function A(e){return S(e,new re)}function M(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)}var W,de=(W=Object.getOwnPropertyDescriptor(RegExp.prototype,"source"))==null?void 0:W.get;var ge=Date.prototype.getTime;function L(e){return typeof e=="object"&&e!==null?A(e):e}function V(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},a=0;function h(u,v,c,w,b,o){let n=u,$=w?w.slice(w.lastIndexOf(".")+1):null,y,p=-1,d,s=!1;if(Array.isArray(n))for(let t=0;t<n.length&&!o.now;t++){let i=n[t];if(i===void 0){n.splice(t,1),a+=1,d=void 0;continue}let f=w?"".concat(w,".").concat(t):"".concat(t);p!==a&&(d===void 0?y=A(n):(y=y.slice(),s?y.splice(d,1):y[d]=L(n[d])),p=a),d=void 0;let m={depth:c,path:f,parent:y,parentType:"array",parentKey:$};b!==void 0&&(m.topmostKey=b);let g=v(i,void 0,m,o);typeof g=="object"&&g!==null&&(g!==i&&(g=A(g)),g=h(g,v,c+1,f,b,o));let O=!1;Number.isNaN(g)&&t<n.length?(n.splice(t,1),a+=1,O=!0):g!==i&&(n[t]=g,a+=1),p!==a&&(d=t,s=O),O&&(t-=1)}else if(M(n))for(let t in n){if(o.now)break;let i=w?"".concat(w,".").concat(t):t;c===0&&(b=t),p!==a&&(d===void 0?y=A(n):(y=C({},y),s?delete y[d]:y[d]=L(n[d])),p=a),d=void 0;let f=n[t],m={depth:c,path:i,parent:y,parentType:"object",parentKey:$};b!==void 0&&(m.topmostKey=b);let g=v(t,f,m,o);typeof g=="object"&&g!==null&&(g!==f&&(g=A(g)),g=h(g,v,c+1,i,b,o));let O=!1;Number.isNaN(g)?(delete n[t],a+=1,O=!0):g!==f&&(n[t]=g,a+=1),p!==a&&(d=t,s=O)}return n}return h(A(e),r,0,"",void 0,l)}var D=ee(F(),1);var J="5.2.2";var oe=J;function se(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 _(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 K={skipContainers:!0,arrayStrictComparison:!1};function H(e,r,l,a,h){let u=C(C({},K),h),v=_(e),c=_(r);v!==c?a("the first input arg is of a type ".concat(v," but the second is ").concat(c,". Values are - 1st:\n").concat(JSON.stringify(e,null,4),"\n2nd:\n").concat(JSON.stringify(r,null,4))):V(r,(w,b,o,n)=>{let $=b!==void 0?b:w,{path:y}=o;if(D.default.has(e,y))if(!u.arrayStrictComparison&&E($)&&o.parentType==="array"&&o.parent.length>1){n.now=!0;let p=Array.from(o.path.includes(".")?D.default.get(e,se(y)):e);if(p.length<o.parent.length)a("the first array: ".concat(JSON.stringify(p,null,4),"\nhas less objects than array we're matching against, ").concat(JSON.stringify(o.parent,null,4)));else{let d=o.parent,s=ae(d,p);for(let[t,i]of s)H(p[i],d[t],l,a,u)}}else{let p=D.default.get(e,y);(!u.skipContainers||!E(p)&&!Array.isArray(p))&&l(p,$,y)}else a("the first input: ".concat(JSON.stringify(e,null,4),'\ndoes not have the path "').concat(y,'", we were looking, would it contain a value ').concat(JSON.stringify($,null,0),"."));return $})}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,h=e.map(o=>r.map(n=>ue(o,n))),u=new Array(l+1).fill(0),v=new Array(a+1).fill(0),c=new Array(a+1).fill(0),w=new Array(a+1).fill(0);for(let o=1;o<=l;o++){c[0]=o;let n=0,$=new Array(a+1).fill(Number.POSITIVE_INFINITY),y=new Array(a+1).fill(!1);do{y[n]=!0;let p=c[n],d=Number.POSITIVE_INFINITY,s=0;for(let t=1;t<=a;t++){if(y[t])continue;let i=-h[p-1][t-1]-u[p]-v[t];i<$[t]&&($[t]=i,w[t]=n),$[t]<d&&(d=$[t],s=t)}for(let t=0;t<=a;t++)y[t]?(u[c[t]]+=d,v[t]-=d):$[t]-=d;n=s}while(c[n]!==0);do{let p=w[n];c[n]=c[p],n=p}while(n!==0)}let b=new Array(l);for(let o=1;o<=a;o++)c[o]>0&&(b[c[o]-1]=o-1);return b.map((o,n)=>[n,o])}return te(fe);})();
|
|
11
11
|
/**
|
|
12
12
|
* @name codsen-utils
|
|
13
13
|
* @fileoverview Various utility functions
|
|
14
|
-
* @version 1.
|
|
14
|
+
* @version 1.9.0
|
|
15
15
|
* @author Roy Revelt
|
|
16
16
|
* @license MIT
|
|
17
17
|
* {@link https://codsen.com/os/codsen-utils/}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
/**
|
|
20
20
|
* @name ast-monkey-traverse
|
|
21
21
|
* @fileoverview Utility library to traverse AST
|
|
22
|
-
* @version 4.2.
|
|
22
|
+
* @version 4.2.2
|
|
23
23
|
* @author Roy Revelt
|
|
24
24
|
* @license MIT
|
|
25
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.2.
|
|
3
|
+
"version": "5.2.2",
|
|
4
4
|
"description": "Like t.same assert on array of objects, where element order doesn't matter.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"array",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"various": {}
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|
|
85
|
-
"ast-monkey-traverse": "^4.2.
|
|
85
|
+
"ast-monkey-traverse": "^4.2.2",
|
|
86
86
|
"object-path": "^0.11.8"
|
|
87
87
|
},
|
|
88
88
|
"engines": {
|