ast-loose-compare 3.0.5 → 3.0.11

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, `2.1.0`.
30
30
 
31
31
  ```bash
32
32
  npm i ast-loose-compare
33
33
  ```
34
34
 
35
- If you need a legacy version which works with `require`, use version 2.1.0
36
-
37
35
  ## Quick Take
38
36
 
39
37
  ```js
40
38
  import { strict as assert } from "assert";
39
+
41
40
  import { looseCompare } from "ast-loose-compare";
42
41
 
43
42
  assert.equal(
@@ -63,7 +62,7 @@ assert.equal(
63
62
 
64
63
  ## Documentation
65
64
 
66
- Please [visit codsen.com](https://codsen.com/os/ast-loose-compare/) for a full description of the API and examples.
65
+ Please [visit codsen.com](https://codsen.com/os/ast-loose-compare/) for a full description of the API.
67
66
 
68
67
  ## Contributing
69
68
 
@@ -73,6 +72,6 @@ To report bugs or request features or assistance, [raise an issue](https://githu
73
72
 
74
73
  MIT License
75
74
 
76
- Copyright (c) 2010-2021 Roy Revelt and other contributors
75
+ Copyright (c) 2010-2022 Roy Revelt and other contributors
77
76
 
78
77
  <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,99 +1,10 @@
1
1
  /**
2
2
  * @name ast-loose-compare
3
3
  * @fileoverview Compare anything: AST, objects, arrays and strings
4
- * @version 3.0.5
4
+ * @version 3.0.11
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/ast-loose-compare/}
8
8
  */
9
9
 
10
- import { empty } from 'ast-contains-only-empty-space';
11
- import isObj from 'lodash.isplainobject';
12
-
13
- var version$1 = "3.0.5";
14
-
15
- const version = version$1;
16
- function internalCompare(bigObj, smallObj, res) {
17
- function existy(x) {
18
- return x != null;
19
- }
20
- let i;
21
- let len;
22
- if (res === undefined) {
23
- if (!existy(bigObj) || !existy(smallObj)) {
24
- return undefined;
25
- }
26
- } else if (!existy(bigObj) || !existy(smallObj)) {
27
- return false;
28
- }
29
- res = res || true;
30
- if (typeof bigObj !== typeof smallObj) {
31
- if (empty(bigObj) && empty(smallObj)) {
32
- return true;
33
- }
34
- return false;
35
- }
36
- if (Array.isArray(bigObj) && Array.isArray(smallObj)) {
37
- if (smallObj.length > 0) {
38
- for (i = 0, len = smallObj.length; i < len; i++) {
39
- if (Array.isArray(smallObj[i]) || isObj(smallObj[i])) {
40
- res = internalCompare(bigObj[i], smallObj[i], res);
41
- if (!res) {
42
- return false;
43
- }
44
- } else if (smallObj[i] !== bigObj[i]) {
45
- if (empty(smallObj[i]) && empty(bigObj[i])) {
46
- return true;
47
- }
48
- return false;
49
- }
50
- }
51
- } else {
52
- if (smallObj.length === 0 && bigObj.length === 0 || empty(smallObj) && empty(bigObj)) {
53
- return true;
54
- }
55
- return false;
56
- }
57
- } else if (isObj(bigObj) && isObj(smallObj)) {
58
- if (Object.keys(smallObj).length > 0) {
59
- const keysArr = Object.keys(smallObj);
60
- for (i = 0, len = keysArr.length; i < len; i++) {
61
- /* istanbul ignore else */
62
- if (Array.isArray(smallObj[keysArr[i]]) || isObj(smallObj[keysArr[i]]) || typeof smallObj[keysArr[i]] === "string") {
63
- res = internalCompare(bigObj[keysArr[i]], smallObj[keysArr[i]], res);
64
- if (!res) {
65
- return false;
66
- }
67
- } else if (smallObj[keysArr[i]] !== bigObj[keysArr[i]]) {
68
- if (!empty(smallObj[keysArr[i]]) || !empty(bigObj[keysArr[i]])) {
69
- return false;
70
- }
71
- }
72
- }
73
- } else {
74
- if (Object.keys(smallObj).length === 0 && Object.keys(bigObj).length === 0 || empty(smallObj) && empty(bigObj)) {
75
- return true;
76
- }
77
- return false;
78
- }
79
- } else if (typeof bigObj === "string" && typeof smallObj === "string") {
80
- /* istanbul ignore else */
81
- if (bigObj !== smallObj) {
82
- if (empty(smallObj) && empty(bigObj)) {
83
- return true;
84
- }
85
- return false;
86
- }
87
- } else {
88
- if (empty(smallObj) && empty(bigObj)) {
89
- return true;
90
- }
91
- return false;
92
- }
93
- return res;
94
- }
95
- function looseCompare(bigObj, smallObj) {
96
- return internalCompare(bigObj, smallObj);
97
- }
98
-
99
- export { looseCompare, version };
10
+ import{empty as r}from"ast-contains-only-empty-space";import i from"lodash.isplainobject";var c="3.0.11";var k=c;function p(t,e,s){function a(o){return o!=null}let n,u;if(s===void 0){if(!a(t)||!a(e))return}else if(!a(t)||!a(e))return!1;if(s=s||!0,typeof t!=typeof e)return!!(r(t)&&r(e));if(Array.isArray(t)&&Array.isArray(e))if(e.length>0){for(n=0,u=e.length;n<u;n++)if(Array.isArray(e[n])||i(e[n])){if(s=p(t[n],e[n],s),!s)return!1}else if(e[n]!==t[n])return!!(r(e[n])&&r(t[n]))}else return!!(e.length===0&&t.length===0||r(e)&&r(t));else if(i(t)&&i(e))if(Object.keys(e).length>0){let o=Object.keys(e);for(n=0,u=o.length;n<u;n++)if(Array.isArray(e[o[n]])||i(e[o[n]])||typeof e[o[n]]=="string"){if(s=p(t[o[n]],e[o[n]],s),!s)return!1}else if(e[o[n]]!==t[o[n]]&&(!r(e[o[n]])||!r(t[o[n]])))return!1}else return!!(Object.keys(e).length===0&&Object.keys(t).length===0||r(e)&&r(t));else if(typeof t=="string"&&typeof e=="string"){if(t!==e)return!!(r(e)&&r(t))}else return!!(r(e)&&r(t));return s}function V(t,e){return p(t,e)}export{V as looseCompare,k as version};
@@ -1,35 +1,34 @@
1
1
  /**
2
2
  * @name ast-loose-compare
3
3
  * @fileoverview Compare anything: AST, objects, arrays and strings
4
- * @version 3.0.5
4
+ * @version 3.0.11
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/ast-loose-compare/}
8
8
  */
9
9
 
10
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).astLooseCompare={})}(this,(function(t){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r={exports:{}};!function(t,r){var n="__lodash_hash_undefined__",o=9007199254740991,u="[object Arguments]",c="[object Boolean]",i="[object Date]",a="[object Function]",f="[object GeneratorFunction]",s="[object Map]",l="[object Number]",p="[object Object]",y="[object Promise]",h="[object RegExp]",_="[object Set]",d="[object String]",b="[object Symbol]",v="[object WeakMap]",g="[object ArrayBuffer]",j="[object DataView]",w="[object Float32Array]",O="[object Float64Array]",A="[object Int8Array]",m="[object Int16Array]",x="[object Int32Array]",S="[object Uint8Array]",$="[object Uint8ClampedArray]",k="[object Uint16Array]",P="[object Uint32Array]",T=/\w*$/,I=/^\[object .+?Constructor\]$/,E=/^(?:0|[1-9]\d*)$/,F={};F[u]=F["[object Array]"]=F[g]=F[j]=F[c]=F[i]=F[w]=F[O]=F[A]=F[m]=F[x]=F[s]=F[l]=F[p]=F[h]=F[_]=F[d]=F[b]=F[S]=F[$]=F[k]=F[P]=!0,F["[object Error]"]=F[a]=F[v]=!1;var N="object"==typeof self&&self&&self.Object===Object&&self,B="object"==typeof e&&e&&e.Object===Object&&e||N||Function("return this")(),M=r&&!r.nodeType&&r,U=M&&t&&!t.nodeType&&t,C=U&&U.exports===M;function D(t,e){return t.set(e[0],e[1]),t}function K(t,e){return t.add(e),t}function L(t,e,r,n){var o=-1,u=t?t.length:0;for(n&&u&&(r=t[++o]);++o<u;)r=e(r,t[o],o,t);return r}function R(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function z(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}function V(t,e){return function(r){return t(e(r))}}function W(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}var G,q=Array.prototype,H=Function.prototype,J=Object.prototype,Q=B["__core-js_shared__"],X=(G=/[^.]+$/.exec(Q&&Q.keys&&Q.keys.IE_PROTO||""))?"Symbol(src)_1."+G:"",Y=H.toString,Z=J.hasOwnProperty,tt=J.toString,et=RegExp("^"+Y.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),rt=C?B.Buffer:void 0,nt=B.Symbol,ot=B.Uint8Array,ut=V(Object.getPrototypeOf,Object),ct=Object.create,it=J.propertyIsEnumerable,at=q.splice,ft=Object.getOwnPropertySymbols,st=rt?rt.isBuffer:void 0,lt=V(Object.keys,Object),pt=Ut(B,"DataView"),yt=Ut(B,"Map"),ht=Ut(B,"Promise"),_t=Ut(B,"Set"),dt=Ut(B,"WeakMap"),bt=Ut(Object,"create"),vt=Rt(pt),gt=Rt(yt),jt=Rt(ht),wt=Rt(_t),Ot=Rt(dt),At=nt?nt.prototype:void 0,mt=At?At.valueOf:void 0;function xt(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 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 $t(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function kt(t){this.__data__=new St(t)}function Pt(t,e){var r=Vt(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&Wt(t)}(t)&&Z.call(t,"callee")&&(!it.call(t,"callee")||tt.call(t)==u)}(t)?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],n=r.length,o=!!n;for(var c in t)!e&&!Z.call(t,c)||o&&("length"==c||Kt(c,n))||r.push(c);return r}function Tt(t,e,r){var n=t[e];Z.call(t,e)&&zt(n,r)&&(void 0!==r||e in t)||(t[e]=r)}function It(t,e){for(var r=t.length;r--;)if(zt(t[r][0],e))return r;return-1}function Et(t,e,r,n,o,y,v){var I;if(n&&(I=y?n(t,o,y,v):n(t)),void 0!==I)return I;if(!Ht(t))return t;var E=Vt(t);if(E){if(I=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,I)}else{var N=Dt(t),B=N==a||N==f;if(Gt(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(N==p||N==u||B&&!y){if(R(t))return y?t:{};if(I=function(t){return"function"!=typeof t.constructor||Lt(t)?{}:(e=ut(t),Ht(e)?ct(e):{});var e}(B?{}:t),!e)return function(t,e){return Bt(t,Ct(t),e)}(t,function(t,e){return t&&Bt(e,Jt(e),t)}(I,t))}else{if(!F[N])return y?t:{};I=function(t,e,r,n){var o=t.constructor;switch(e){case g:return Nt(t);case c:case i:return new o(+t);case j:return function(t,e){var r=e?Nt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,n);case w:case O:case A:case m:case x:case S:case $:case k:case P:return function(t,e){var r=e?Nt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}(t,n);case s:return function(t,e,r){return L(e?r(z(t),!0):z(t),D,new t.constructor)}(t,n,r);case l:case d:return new o(t);case h:return function(t){var e=new t.constructor(t.source,T.exec(t));return e.lastIndex=t.lastIndex,e}(t);case _:return function(t,e,r){return L(e?r(W(t),!0):W(t),K,new t.constructor)}(t,n,r);case b:return u=t,mt?Object(mt.call(u)):{}}var u}(t,N,Et,e)}}v||(v=new kt);var M=v.get(t);if(M)return M;if(v.set(t,I),!E)var U=r?function(t){return function(t,e,r){var n=e(t);return Vt(t)?n:function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}(n,r(t))}(t,Jt,Ct)}(t):Jt(t);return function(t,e){for(var r=-1,n=t?t.length:0;++r<n&&!1!==e(t[r],r,t););}(U||t,(function(o,u){U&&(o=t[u=o]),Tt(I,u,Et(o,e,r,n,u,t,v))})),I}function Ft(t){return!(!Ht(t)||(e=t,X&&X in e))&&(qt(t)||R(t)?et:I).test(Rt(t));var e}function Nt(t){var e=new t.constructor(t.byteLength);return new ot(e).set(new ot(t)),e}function Bt(t,e,r,n){r||(r={});for(var o=-1,u=e.length;++o<u;){var c=e[o],i=n?n(r[c],t[c],c,r,t):void 0;Tt(r,c,void 0===i?t[c]:i)}return r}function Mt(t,e){var r,n,o=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof e?"string":"hash"]:o.map}function Ut(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return Ft(r)?r:void 0}xt.prototype.clear=function(){this.__data__=bt?bt(null):{}},xt.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},xt.prototype.get=function(t){var e=this.__data__;if(bt){var r=e[t];return r===n?void 0:r}return Z.call(e,t)?e[t]:void 0},xt.prototype.has=function(t){var e=this.__data__;return bt?void 0!==e[t]:Z.call(e,t)},xt.prototype.set=function(t,e){return this.__data__[t]=bt&&void 0===e?n:e,this},St.prototype.clear=function(){this.__data__=[]},St.prototype.delete=function(t){var e=this.__data__,r=It(e,t);return!(r<0)&&(r==e.length-1?e.pop():at.call(e,r,1),!0)},St.prototype.get=function(t){var e=this.__data__,r=It(e,t);return r<0?void 0:e[r][1]},St.prototype.has=function(t){return It(this.__data__,t)>-1},St.prototype.set=function(t,e){var r=this.__data__,n=It(r,t);return n<0?r.push([t,e]):r[n][1]=e,this},$t.prototype.clear=function(){this.__data__={hash:new xt,map:new(yt||St),string:new xt}},$t.prototype.delete=function(t){return Mt(this,t).delete(t)},$t.prototype.get=function(t){return Mt(this,t).get(t)},$t.prototype.has=function(t){return Mt(this,t).has(t)},$t.prototype.set=function(t,e){return Mt(this,t).set(t,e),this},kt.prototype.clear=function(){this.__data__=new St},kt.prototype.delete=function(t){return this.__data__.delete(t)},kt.prototype.get=function(t){return this.__data__.get(t)},kt.prototype.has=function(t){return this.__data__.has(t)},kt.prototype.set=function(t,e){var r=this.__data__;if(r instanceof St){var n=r.__data__;if(!yt||n.length<199)return n.push([t,e]),this;r=this.__data__=new $t(n)}return r.set(t,e),this};var Ct=ft?V(ft,Object):function(){return[]},Dt=function(t){return tt.call(t)};function Kt(t,e){return!!(e=null==e?o:e)&&("number"==typeof t||E.test(t))&&t>-1&&t%1==0&&t<e}function Lt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||J)}function Rt(t){if(null!=t){try{return Y.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function zt(t,e){return t===e||t!=t&&e!=e}(pt&&Dt(new pt(new ArrayBuffer(1)))!=j||yt&&Dt(new yt)!=s||ht&&Dt(ht.resolve())!=y||_t&&Dt(new _t)!=_||dt&&Dt(new dt)!=v)&&(Dt=function(t){var e=tt.call(t),r=e==p?t.constructor:void 0,n=r?Rt(r):void 0;if(n)switch(n){case vt:return j;case gt:return s;case jt:return y;case wt:return _;case Ot:return v}return e});var Vt=Array.isArray;function Wt(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=o}(t.length)&&!qt(t)}var Gt=st||function(){return!1};function qt(t){var e=Ht(t)?tt.call(t):"";return e==a||e==f}function Ht(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Jt(t){return Wt(t)?Pt(t):function(t){if(!Lt(t))return lt(t);var e=[];for(var r in Object(t))Z.call(t,r)&&"constructor"!=r&&e.push(r);return e}(t)}t.exports=function(t){return Et(t,!0,!0)}}(r,r.exports);var n=r.exports;var o,u,c=Object.prototype,i=Function.prototype.toString,a=c.hasOwnProperty,f=i.call(Object),s=c.toString,l=(o=Object.getPrototypeOf,u=Object,function(t){return o(u(t))});var p=function(t){if(!function(t){return!!t&&"object"==typeof t}(t)||"[object Object]"!=s.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=l(t);if(null===e)return!0;var r=a.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&i.call(r)==f};
10
+ var astLooseCompare=(()=>{var se=Object.create;var j=Object.defineProperty,ce=Object.defineProperties,ue=Object.getOwnPropertyDescriptor,fe=Object.getOwnPropertyDescriptors,le=Object.getOwnPropertyNames,st=Object.getOwnPropertySymbols,pe=Object.getPrototypeOf,ct=Object.prototype.hasOwnProperty,de=Object.prototype.propertyIsEnumerable;var ut=(t,e,r)=>e in t?j(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,x=(t,e)=>{for(var r in e||(e={}))ct.call(e,r)&&ut(t,r,e[r]);if(st)for(var r of st(e))de.call(e,r)&&ut(t,r,e[r]);return t},I=(t,e)=>ce(t,fe(e)),ft=t=>j(t,"__esModule",{value:!0});var lt=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),he=(t,e)=>{for(var r in e)j(t,r,{get:e[r],enumerable:!0})},pt=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of le(e))!ct.call(t,o)&&(r||o!=="default")&&j(t,o,{get:()=>e[o],enumerable:!(n=ue(e,o))||n.enumerable});return t},D=(t,e)=>pt(ft(j(t!=null?se(pe(t)):{},"default",!e&&t&&t.__esModule?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t),ye=(t=>(e,r)=>t&&t.get(e)||(r=pt(ft({}),e,1),t&&t.set(e,r),r))(typeof WeakMap!="undefined"?new WeakMap:0);var te=lt((P,C)=>{var ge=200,dt="__lodash_hash_undefined__",ht=9007199254740991,H="[object Arguments]",_e="[object Array]",yt="[object Boolean]",gt="[object Date]",ve="[object Error]",L="[object Function]",_t="[object GeneratorFunction]",U="[object Map]",vt="[object Number]",F="[object Object]",bt="[object Promise]",wt="[object RegExp]",k="[object Set]",mt="[object String]",xt="[object Symbol]",W="[object WeakMap]",At="[object ArrayBuffer]",M="[object DataView]",Tt="[object Float32Array]",St="[object Float64Array]",Ct="[object Int8Array]",jt="[object Int16Array]",It="[object Int32Array]",Ot="[object Uint8Array]",Vt="[object Uint8ClampedArray]",Pt="[object Uint16Array]",$t="[object Uint32Array]",be=/[\\^$.*+?()[\]{}|]/g,we=/\w*$/,me=/^\[object .+?Constructor\]$/,xe=/^(?:0|[1-9]\d*)$/,s={};s[H]=s[_e]=s[At]=s[M]=s[yt]=s[gt]=s[Tt]=s[St]=s[Ct]=s[jt]=s[It]=s[U]=s[vt]=s[F]=s[wt]=s[k]=s[mt]=s[xt]=s[Ot]=s[Vt]=s[Pt]=s[$t]=!0;s[ve]=s[L]=s[W]=!1;var Ae=typeof global=="object"&&global&&global.Object===Object&&global,Te=typeof self=="object"&&self&&self.Object===Object&&self,h=Ae||Te||Function("return this")(),Et=typeof P=="object"&&P&&!P.nodeType&&P,Ut=Et&&typeof C=="object"&&C&&!C.nodeType&&C,Se=Ut&&Ut.exports===Et;function Ce(t,e){return t.set(e[0],e[1]),t}function je(t,e){return t.add(e),t}function Ie(t,e){for(var r=-1,n=t?t.length:0;++r<n&&e(t[r],r,t)!==!1;);return t}function Oe(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}function kt(t,e,r,n){var o=-1,i=t?t.length:0;for(n&&i&&(r=t[++o]);++o<i;)r=e(r,t[o],o,t);return r}function Ve(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function Pe(t,e){return t==null?void 0:t[e]}function Mt(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch(r){}return e}function Nt(t){var e=-1,r=Array(t.size);return t.forEach(function(n,o){r[++e]=[o,n]}),r}function q(t,e){return function(r){return t(e(r))}}function Jt(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var $e=Array.prototype,Ee=Function.prototype,N=Object.prototype,X=h["__core-js_shared__"],Rt=function(){var t=/[^.]+$/.exec(X&&X.keys&&X.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),Gt=Ee.toString,_=N.hasOwnProperty,J=N.toString,Ue=RegExp("^"+Gt.call(_).replace(be,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Kt=Se?h.Buffer:void 0,Bt=h.Symbol,Dt=h.Uint8Array,ke=q(Object.getPrototypeOf,Object),Me=Object.create,Ne=N.propertyIsEnumerable,Je=$e.splice,Ht=Object.getOwnPropertySymbols,Re=Kt?Kt.isBuffer:void 0,Ge=q(Object.keys,Object),Y=S(h,"DataView"),O=S(h,"Map"),Z=S(h,"Promise"),Q=S(h,"Set"),z=S(h,"WeakMap"),V=S(Object,"create"),Ke=m(Y),Be=m(O),De=m(Z),He=m(Q),Le=m(z),Lt=Bt?Bt.prototype:void 0,Ft=Lt?Lt.valueOf:void 0;function b(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 Fe(){this.__data__=V?V(null):{}}function We(t){return this.has(t)&&delete this.__data__[t]}function qe(t){var e=this.__data__;if(V){var r=e[t];return r===dt?void 0:r}return _.call(e,t)?e[t]:void 0}function Xe(t){var e=this.__data__;return V?e[t]!==void 0:_.call(e,t)}function Ye(t,e){var r=this.__data__;return r[t]=V&&e===void 0?dt:e,this}b.prototype.clear=Fe;b.prototype.delete=We;b.prototype.get=qe;b.prototype.has=Xe;b.prototype.set=Ye;function y(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 Ze(){this.__data__=[]}function Qe(t){var e=this.__data__,r=R(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():Je.call(e,r,1),!0}function ze(t){var e=this.__data__,r=R(e,t);return r<0?void 0:e[r][1]}function tr(t){return R(this.__data__,t)>-1}function er(t,e){var r=this.__data__,n=R(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}y.prototype.clear=Ze;y.prototype.delete=Qe;y.prototype.get=ze;y.prototype.has=tr;y.prototype.set=er;function A(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 rr(){this.__data__={hash:new b,map:new(O||y),string:new b}}function nr(t){return G(this,t).delete(t)}function or(t){return G(this,t).get(t)}function ar(t){return G(this,t).has(t)}function ir(t,e){return G(this,t).set(t,e),this}A.prototype.clear=rr;A.prototype.delete=nr;A.prototype.get=or;A.prototype.has=ar;A.prototype.set=ir;function T(t){this.__data__=new y(t)}function sr(){this.__data__=new y}function cr(t){return this.__data__.delete(t)}function ur(t){return this.__data__.get(t)}function fr(t){return this.__data__.has(t)}function lr(t,e){var r=this.__data__;if(r instanceof y){var n=r.__data__;if(!O||n.length<ge-1)return n.push([t,e]),this;r=this.__data__=new A(n)}return r.set(t,e),this}T.prototype.clear=sr;T.prototype.delete=cr;T.prototype.get=ur;T.prototype.has=fr;T.prototype.set=lr;function pr(t,e){var r=rt(t)||Mr(t)?Ve(t.length,String):[],n=r.length,o=!!n;for(var i in t)(e||_.call(t,i))&&!(o&&(i=="length"||$r(i,n)))&&r.push(i);return r}function Wt(t,e,r){var n=t[e];(!(_.call(t,e)&&Zt(n,r))||r===void 0&&!(e in t))&&(t[e]=r)}function R(t,e){for(var r=t.length;r--;)if(Zt(t[r][0],e))return r;return-1}function dr(t,e){return t&&qt(e,nt(e),t)}function tt(t,e,r,n,o,i,a){var u;if(n&&(u=i?n(t,o,i,a):n(t)),u!==void 0)return u;if(!K(t))return t;var l=rt(t);if(l){if(u=Or(t),!e)return Cr(t,u)}else{var d=w(t),f=d==L||d==_t;if(Jr(t))return br(t,e);if(d==F||d==H||f&&!i){if(Mt(t))return i?t:{};if(u=Vr(f?{}:t),!e)return jr(t,dr(u,t))}else{if(!s[d])return i?t:{};u=Pr(t,d,tt,e)}}a||(a=new T);var c=a.get(t);if(c)return c;if(a.set(t,u),!l)var g=r?Ir(t):nt(t);return Ie(g||t,function(v,E){g&&(E=v,v=t[E]),Wt(u,E,tt(v,e,r,n,E,t,a))}),u}function hr(t){return K(t)?Me(t):{}}function yr(t,e,r){var n=e(t);return rt(t)?n:Oe(n,r(t))}function gr(t){return J.call(t)}function _r(t){if(!K(t)||Ur(t))return!1;var e=zt(t)||Mt(t)?Ue:me;return e.test(m(t))}function vr(t){if(!Yt(t))return Ge(t);var e=[];for(var r in Object(t))_.call(t,r)&&r!="constructor"&&e.push(r);return e}function br(t,e){if(e)return t.slice();var r=new t.constructor(t.length);return t.copy(r),r}function et(t){var e=new t.constructor(t.byteLength);return new Dt(e).set(new Dt(t)),e}function wr(t,e){var r=e?et(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}function mr(t,e,r){var n=e?r(Nt(t),!0):Nt(t);return kt(n,Ce,new t.constructor)}function xr(t){var e=new t.constructor(t.source,we.exec(t));return e.lastIndex=t.lastIndex,e}function Ar(t,e,r){var n=e?r(Jt(t),!0):Jt(t);return kt(n,je,new t.constructor)}function Tr(t){return Ft?Object(Ft.call(t)):{}}function Sr(t,e){var r=e?et(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}function Cr(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}function qt(t,e,r,n){r||(r={});for(var o=-1,i=e.length;++o<i;){var a=e[o],u=n?n(r[a],t[a],a,r,t):void 0;Wt(r,a,u===void 0?t[a]:u)}return r}function jr(t,e){return qt(t,Xt(t),e)}function Ir(t){return yr(t,nt,Xt)}function G(t,e){var r=t.__data__;return Er(e)?r[typeof e=="string"?"string":"hash"]:r.map}function S(t,e){var r=Pe(t,e);return _r(r)?r:void 0}var Xt=Ht?q(Ht,Object):Kr,w=gr;(Y&&w(new Y(new ArrayBuffer(1)))!=M||O&&w(new O)!=U||Z&&w(Z.resolve())!=bt||Q&&w(new Q)!=k||z&&w(new z)!=W)&&(w=function(t){var e=J.call(t),r=e==F?t.constructor:void 0,n=r?m(r):void 0;if(n)switch(n){case Ke:return M;case Be:return U;case De:return bt;case He:return k;case Le:return W}return e});function Or(t){var e=t.length,r=t.constructor(e);return e&&typeof t[0]=="string"&&_.call(t,"index")&&(r.index=t.index,r.input=t.input),r}function Vr(t){return typeof t.constructor=="function"&&!Yt(t)?hr(ke(t)):{}}function Pr(t,e,r,n){var o=t.constructor;switch(e){case At:return et(t);case yt:case gt:return new o(+t);case M:return wr(t,n);case Tt:case St:case Ct:case jt:case It:case Ot:case Vt:case Pt:case $t:return Sr(t,n);case U:return mr(t,n,r);case vt:case mt:return new o(t);case wt:return xr(t);case k:return Ar(t,n,r);case xt:return Tr(t)}}function $r(t,e){return e=e==null?ht:e,!!e&&(typeof t=="number"||xe.test(t))&&t>-1&&t%1==0&&t<e}function Er(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function Ur(t){return!!Rt&&Rt in t}function Yt(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||N;return t===r}function m(t){if(t!=null){try{return Gt.call(t)}catch(e){}try{return t+""}catch(e){}}return""}function kr(t){return tt(t,!0,!0)}function Zt(t,e){return t===e||t!==t&&e!==e}function Mr(t){return Nr(t)&&_.call(t,"callee")&&(!Ne.call(t,"callee")||J.call(t)==H)}var rt=Array.isArray;function Qt(t){return t!=null&&Rr(t.length)&&!zt(t)}function Nr(t){return Gr(t)&&Qt(t)}var Jr=Re||Br;function zt(t){var e=K(t)?J.call(t):"";return e==L||e==_t}function Rr(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=ht}function K(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function Gr(t){return!!t&&typeof t=="object"}function nt(t){return Qt(t)?pr(t):vr(t)}function Kr(){return[]}function Br(){return!1}C.exports=kr});var ot=lt((an,ne)=>{var Dr="[object Object]";function Hr(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch(r){}return e}function Lr(t,e){return function(r){return t(e(r))}}var Fr=Function.prototype,ee=Object.prototype,re=Fr.toString,Wr=ee.hasOwnProperty,qr=re.call(Object),Xr=ee.toString,Yr=Lr(Object.getPrototypeOf,Object);function Zr(t){return!!t&&typeof t=="object"}function Qr(t){if(!Zr(t)||Xr.call(t)!=Dr||Hr(t))return!1;var e=Yr(t);if(e===null)return!0;var r=Wr.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&re.call(r)==qr}ne.exports=Qr});var nn={};he(nn,{looseCompare:()=>rn,version:()=>en});var B=D(te(),1),oe=D(ot(),1);function zr(t){if(t.includes(".")){let 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}var at=zr;function ae(t,e){let r={now:!1};function n(o,i,a,u){let l=(0,B.default)(o),d,f=x({depth:-1,path:""},a);if(f.depth+=1,Array.isArray(l))for(let c=0,g=l.length;c<g&&!u.now;c++){let v=f.path?`${f.path}.${c}`:`${c}`;l[c]!==void 0?(f.parent=(0,B.default)(l),f.parentType="array",f.parentKey=at(v),d=n(i(l[c],void 0,I(x({},f),{path:v}),u),i,I(x({},f),{path:v}),u),Number.isNaN(d)&&c<l.length?(l.splice(c,1),c-=1):l[c]=d):l.splice(c,1)}else if((0,oe.default)(l))for(let c in l){if(u.now&&c!=null)break;let g=f.path?`${f.path}.${c}`:c;f.depth===0&&c!=null&&(f.topmostKey=c),f.parent=(0,B.default)(l),f.parentType="object",f.parentKey=at(g),d=n(i(c,l[c],I(x({},f),{path:g}),u),i,I(x({},f),{path:g}),u),Number.isNaN(d)?delete l[c]:l[c]=d}return l}return n(t,e,{},r)}function p(t){if(typeof t=="string")return!t.trim();if(!["object","string"].includes(typeof t)||!t)return!1;let e=!0;return t=ae(t,(r,n,o,i)=>{let a=n!==void 0?n:r;return typeof a=="string"&&a.trim()&&(e=!1,i.now=!0),a}),e}var $=D(ot(),1);var ie="3.0.11";var en=ie;function it(t,e,r){function n(a){return a!=null}let o,i;if(r===void 0){if(!n(t)||!n(e))return}else if(!n(t)||!n(e))return!1;if(r=r||!0,typeof t!=typeof e)return!!(p(t)&&p(e));if(Array.isArray(t)&&Array.isArray(e))if(e.length>0){for(o=0,i=e.length;o<i;o++)if(Array.isArray(e[o])||(0,$.default)(e[o])){if(r=it(t[o],e[o],r),!r)return!1}else if(e[o]!==t[o])return!!(p(e[o])&&p(t[o]))}else return!!(e.length===0&&t.length===0||p(e)&&p(t));else if((0,$.default)(t)&&(0,$.default)(e))if(Object.keys(e).length>0){let a=Object.keys(e);for(o=0,i=a.length;o<i;o++)if(Array.isArray(e[a[o]])||(0,$.default)(e[a[o]])||typeof e[a[o]]=="string"){if(r=it(t[a[o]],e[a[o]],r),!r)return!1}else if(e[a[o]]!==t[a[o]]&&(!p(e[a[o]])||!p(t[a[o]])))return!1}else return!!(Object.keys(e).length===0&&Object.keys(t).length===0||p(e)&&p(t));else if(typeof t=="string"&&typeof e=="string"){if(t!==e)return!!(p(e)&&p(t))}else return!!(p(e)&&p(t));return r}function rn(t,e){return it(t,e)}return ye(nn);})();
11
11
  /**
12
- * @name ast-monkey-util
13
- * @fileoverview Utility library of AST helper functions
14
- * @version 2.0.5
12
+ * @name ast-contains-only-empty-space
13
+ * @fileoverview Does AST contain only empty space?
14
+ * @version 3.0.11
15
15
  * @author Roy Revelt, Codsen Ltd
16
16
  * @license MIT
17
- * {@link https://codsen.com/os/ast-monkey-util/}
18
- */function y(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}
17
+ * {@link https://codsen.com/os/ast-contains-only-empty-space/}
18
+ */
19
19
  /**
20
20
  * @name ast-monkey-traverse
21
21
  * @fileoverview Utility library to traverse AST
22
- * @version 3.0.5
22
+ * @version 3.0.11
23
23
  * @author Roy Revelt, Codsen Ltd
24
24
  * @license MIT
25
25
  * {@link https://codsen.com/os/ast-monkey-traverse/}
26
26
  */
27
27
  /**
28
- * @name ast-contains-only-empty-space
29
- * @fileoverview Does AST contain only empty space?
30
- * @version 3.0.5
28
+ * @name ast-monkey-util
29
+ * @fileoverview Utility library of AST helper functions
30
+ * @version 2.0.11
31
31
  * @author Roy Revelt, Codsen Ltd
32
32
  * @license MIT
33
- * {@link https://codsen.com/os/ast-contains-only-empty-space/}
33
+ * {@link https://codsen.com/os/ast-monkey-util/}
34
34
  */
35
- function h(t){if("string"==typeof t)return!t.trim();if(!["object","string"].includes(typeof t)||!t)return!1;let e=!0;return t=function t(e,r,o,u){const c=n(e);let i;const a={depth:-1,path:"",...o};if(a.depth+=1,Array.isArray(c))for(let e=0,o=c.length;e<o&&!u.now;e++){const o=a.path?`${a.path}.${e}`:`${e}`;void 0!==c[e]?(a.parent=n(c),a.parentType="array",a.parentKey=y(o),i=t(r(c[e],void 0,{...a,path:o},u),r,{...a,path:o},u),Number.isNaN(i)&&e<c.length?(c.splice(e,1),e-=1):c[e]=i):c.splice(e,1)}else if(p(c))for(const e in c){if(u.now&&null!=e)break;const o=a.path?`${a.path}.${e}`:e;0===a.depth&&null!=e&&(a.topmostKey=e),a.parent=n(c),a.parentType="object",a.parentKey=y(o),i=t(r(e,c[e],{...a,path:o},u),r,{...a,path:o},u),Number.isNaN(i)?delete c[e]:c[e]=i}return c}(t,((t,r,n,o)=>{const u=void 0!==r?r:t;return"string"==typeof u&&u.trim()&&(e=!1,o.now=!0),u}),{},{now:!1}),e}function _(t,e,r){function n(t){return null!=t}let o,u;if(void 0===r){if(!n(t)||!n(e))return}else if(!n(t)||!n(e))return!1;if(r=r||!0,typeof t!=typeof e)return!(!h(t)||!h(e));if(Array.isArray(t)&&Array.isArray(e)){if(!(e.length>0))return!!(0===e.length&&0===t.length||h(e)&&h(t));for(o=0,u=e.length;o<u;o++)if(Array.isArray(e[o])||p(e[o])){if(!(r=_(t[o],e[o],r)))return!1}else if(e[o]!==t[o])return!(!h(e[o])||!h(t[o]))}else if(p(t)&&p(e)){if(!(Object.keys(e).length>0))return!!(0===Object.keys(e).length&&0===Object.keys(t).length||h(e)&&h(t));{const n=Object.keys(e);for(o=0,u=n.length;o<u;o++)if(Array.isArray(e[n[o]])||p(e[n[o]])||"string"==typeof e[n[o]]){if(!(r=_(t[n[o]],e[n[o]],r)))return!1}else if(!(e[n[o]]===t[n[o]]||h(e[n[o]])&&h(t[n[o]])))return!1}}else{if("string"!=typeof t||"string"!=typeof e)return!(!h(e)||!h(t));if(t!==e)return!(!h(e)||!h(t))}return r}t.looseCompare=function(t,e){return _(t,e)},t.version="3.0.5",Object.defineProperty(t,"__esModule",{value:!0})}));
@@ -1,6 +1,7 @@
1
1
  // Quick Take
2
2
 
3
3
  import { strict as assert } from "assert";
4
+
4
5
  import { looseCompare } from "../dist/ast-loose-compare.esm.js";
5
6
 
6
7
  assert.equal(
@@ -1,6 +1,7 @@
1
1
  // More Examples
2
2
 
3
3
  import { strict as assert } from "assert";
4
+
4
5
  import { looseCompare } from "../dist/ast-loose-compare.esm.js";
5
6
 
6
7
  assert.equal(
@@ -1,6 +1,7 @@
1
1
  // Empty Values
2
2
 
3
3
  import { strict as assert } from "assert";
4
+
4
5
  import { looseCompare } from "../dist/ast-loose-compare.esm.js";
5
6
 
6
7
  // both values are empty - they trim() to zero-length
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ast-loose-compare",
3
- "version": "3.0.5",
3
+ "version": "3.0.11",
4
4
  "description": "Compare anything: AST, objects, arrays and strings",
5
5
  "keywords": [
6
6
  "array",
@@ -42,98 +42,43 @@
42
42
  },
43
43
  "types": "types/index.d.ts",
44
44
  "scripts": {
45
- "build": "rollup -c",
46
- "ci_test": "npm run build && npm run format && tap --no-only --reporter=silent --output-file=testStats.md && npm run clean_cov",
47
- "clean_cov": "../../scripts/leaveCoverageTotalOnly.js",
48
- "clean_types": "../../scripts/cleanTypes.js",
49
- "dev": "rollup -c --dev",
50
- "devunittest": "npm run dev && tap --only -R 'base'",
51
- "esbuild": "node '../../scripts/esbuild.js'",
52
- "esbuild_dev": "cross-env MODE=dev node '../../scripts/esbuild.js'",
53
- "format": "npm run lect && npm run prettier && npm run lint",
54
- "lect": "lect",
55
- "lint": "../../node_modules/eslint/bin/eslint.js . --ext .js --ext .ts --fix --config \"../../.eslintrc.json\" --quiet",
56
- "perf": "node perf/check",
57
- "prettier": "../../node_modules/prettier/bin-prettier.js '*.{js,css,scss,vue,md,ts}' --write --loglevel silent",
58
- "republish": "npm publish || :",
59
- "tap": "tap",
60
- "pretest": "npm run build",
61
- "test": "npm run lint && npm run unittest && npm run test:examples && npm run clean_cov && npm run format",
62
- "test:examples": "../../scripts/test-examples.js && npm run lect && npm run prettier",
63
- "tsc": "tsc",
64
- "unittest": "tap --no-only --output-file=testStats.md --reporter=terse && tsc -p tsconfig.json --noEmit && npm run clean_cov && npm run perf"
45
+ "build": "node '../../ops/scripts/esbuild.js' && yarn run dts",
46
+ "dev": "DEV=true node '../../ops/scripts/esbuild.js' && yarn run dts",
47
+ "dts": "rollup -c && yarn run prettier 'types/index.d.ts' --write",
48
+ "examples": "node '../../ops/scripts/run-examples.js'",
49
+ "lect": "node '../../ops/lect/lect.js'",
50
+ "letspublish": "yarn publish || :",
51
+ "lint": "eslint . --fix",
52
+ "perf": "node perf/check.js",
53
+ "prepare": "echo 'ready'",
54
+ "prettier": "prettier",
55
+ "prettier:format": "prettier --write '**/*.{ts,tsx,md}' --no-error-on-unmatched-pattern",
56
+ "pretest": "yarn run lect && yarn run build",
57
+ "test": "c8 yarn run unit && yarn run examples && yarn run lint",
58
+ "unit": "uvu test"
65
59
  },
66
- "tap": {
67
- "check-coverage": false,
68
- "coverage-report": [
69
- "json-summary",
70
- "text"
71
- ],
72
- "node-arg": [
73
- "--no-warnings",
74
- "--experimental-loader",
75
- "@istanbuljs/esm-loader-hook"
60
+ "engines": {
61
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
62
+ },
63
+ "c8": {
64
+ "check-coverage": true,
65
+ "exclude": [
66
+ "**/test/**/*.*"
76
67
  ],
77
- "timeout": 0
68
+ "lines": 100
78
69
  },
79
70
  "lect": {
80
71
  "licence": {
81
72
  "extras": [
82
73
  ""
83
74
  ]
84
- },
85
- "req": "{ looseCompare }",
86
- "various": {
87
- "devDependencies": [
88
- "@types/lodash.isplainobject"
89
- ]
90
75
  }
91
76
  },
92
77
  "dependencies": {
93
- "@babel/runtime": "^7.16.0",
94
- "ast-contains-only-empty-space": "^3.0.5",
78
+ "ast-contains-only-empty-space": "^3.0.11",
95
79
  "lodash.isplainobject": "^4.0.6"
96
80
  },
97
81
  "devDependencies": {
98
- "@babel/cli": "^7.16.0",
99
- "@babel/core": "^7.16.0",
100
- "@babel/node": "^7.16.0",
101
- "@babel/plugin-external-helpers": "^7.16.0",
102
- "@babel/plugin-proposal-class-properties": "^7.16.0",
103
- "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.0",
104
- "@babel/plugin-proposal-object-rest-spread": "^7.16.0",
105
- "@babel/plugin-proposal-optional-chaining": "^7.16.0",
106
- "@babel/plugin-transform-runtime": "^7.16.0",
107
- "@babel/preset-env": "^7.16.0",
108
- "@babel/preset-typescript": "^7.16.0",
109
- "@babel/register": "^7.16.0",
110
- "@istanbuljs/esm-loader-hook": "^0.1.2",
111
- "@rollup/plugin-babel": "^5.3.0",
112
- "@rollup/plugin-commonjs": "^21.0.1",
113
- "@rollup/plugin-json": "^4.1.0",
114
- "@rollup/plugin-node-resolve": "^13.0.6",
115
- "@rollup/plugin-strip": "^2.1.0",
116
- "@rollup/plugin-typescript": "^8.3.0",
117
- "@types/lodash.isplainobject": "^4.0.6",
118
- "@types/node": "^16.11.6",
119
- "@types/tap": "^15.0.5",
120
- "@typescript-eslint/eslint-plugin": "^5.3.0",
121
- "@typescript-eslint/parser": "^5.3.0",
122
- "core-js": "^3.19.1",
123
- "cross-env": "^7.0.3",
124
- "eslint": "^8.2.0",
125
- "lect": "^0.18.5",
126
- "rollup": "^2.59.0",
127
- "rollup-plugin-ascii": "^0.0.3",
128
- "rollup-plugin-banner": "^0.2.1",
129
- "rollup-plugin-cleanup": "^3.2.1",
130
- "rollup-plugin-dts": "^4.0.1",
131
- "rollup-plugin-terser": "^7.0.2",
132
- "tap": "^15.0.10",
133
- "tslib": "^2.3.1",
134
- "typescript": "^4.4.4"
135
- },
136
- "engines": {
137
- "node": ">=12"
82
+ "@types/lodash.isplainobject": "^4.0.6"
138
83
  }
139
84
  }
package/types/index.d.ts CHANGED
@@ -1,12 +1,21 @@
1
1
  declare const version: string;
2
- declare type JsonValue = string | number | boolean | null | JsonObject | JsonArray;
2
+ declare type JsonValue =
3
+ | string
4
+ | number
5
+ | boolean
6
+ | null
7
+ | JsonObject
8
+ | JsonArray;
3
9
  declare type JsonObject = {
4
- [Key in string]?: JsonValue;
10
+ [Key in string]?: JsonValue;
5
11
  };
6
- declare type JsonArray = Array<JsonValue>;
12
+ declare type JsonArray = JsonValue[];
7
13
  /**
8
14
  * Compare anything: AST, objects, arrays and strings
9
15
  */
10
- declare function looseCompare(bigObj: JsonValue, smallObj: JsonValue): boolean | undefined;
16
+ declare function looseCompare(
17
+ bigObj: JsonValue,
18
+ smallObj: JsonValue
19
+ ): boolean | undefined;
11
20
 
12
21
  export { looseCompare, 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; looseCompare &#x7D; from \"ast-loose-compare\";\n\nassert.equal(\n looseCompare(\n &#x7B;\n a: &#x7B;\n b: \"d\",\n c: [],\n e: \"f\",\n g: \"h\",\n &#x7D;,\n &#x7D;,\n &#x7B;\n a: &#x7B;\n b: \"d\",\n c: [],\n &#x7D;,\n &#x7D;\n ),\n true\n);"},"more-examples.js":{"title":"More Examples","content":"import &#x7B; strict as assert &#x7D; from \"assert\";\nimport &#x7B; looseCompare &#x7D; from \"ast-loose-compare\";\n\nassert.equal(\n looseCompare(&#x7B; a: \"1\", b: \"2\", c: \"3\" &#x7D;, &#x7B; a: \"1\", b: \"2\" &#x7D;),\n true\n);\n// true, because second (smallObj) is subset of (or equal) first (bigObj).\n\nassert.equal(\n looseCompare(&#x7B; a: \"1\", b: \"2\" &#x7D;, &#x7B; a: \"1\", b: \"2\", c: \"3\" &#x7D;),\n false\n);\n// false, because second (smallObj) is not a subset (or equal) to first (bigObj).\n\nassert.equal(looseCompare([\"a\", \"b\", \"c\"], [\"a\", \"b\"]), true);\n// true, because second is a subset of first\n\nassert.equal(looseCompare([\"a\", \"b\"], [\"a\", \"b\", \"c\"]), false);\n// false, because second is not a subset of first\n\nassert.equal(looseCompare(\"aaaaa\\nbbbbb\", \"aaaaa\\nbbbbb\"), true);\n// true, because strings are equal\n\nassert.equal(looseCompare(&#x7B; a: \"a\" &#x7D;), undefined);\n// the second argument is missing"},"whitespace.js":{"title":"Empty Values","content":"import &#x7B; strict as assert &#x7D; from \"assert\";\nimport &#x7B; looseCompare &#x7D; from \"ast-loose-compare\";\n\n// both values are empty - they trim() to zero-length\nassert.equal(\n looseCompare(\n &#x7B;\n a: \"a\",\n b: \"\\n \\n\\n\",\n &#x7D;,\n &#x7B;\n a: \"a\",\n b: \"\\t\\t \\t\",\n &#x7D;\n ),\n true\n);"}}