ast-loose-compare 3.0.6 → 3.0.7
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name ast-loose-compare
|
|
3
3
|
* @fileoverview Compare anything: AST, objects, arrays and strings
|
|
4
|
-
* @version 3.0.
|
|
4
|
+
* @version 3.0.7
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/ast-loose-compare/}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import { empty } from 'ast-contains-only-empty-space';
|
|
11
11
|
import isObj from 'lodash.isplainobject';
|
|
12
12
|
|
|
13
|
-
var version$1 = "3.0.
|
|
13
|
+
var version$1 = "3.0.7";
|
|
14
14
|
|
|
15
15
|
const version = version$1;
|
|
16
16
|
function internalCompare(bigObj, smallObj, res) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name ast-loose-compare
|
|
3
3
|
* @fileoverview Compare anything: AST, objects, arrays and strings
|
|
4
|
-
* @version 3.0.
|
|
4
|
+
* @version 3.0.7
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/ast-loose-compare/}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
/**
|
|
12
12
|
* @name ast-monkey-util
|
|
13
13
|
* @fileoverview Utility library of AST helper functions
|
|
14
|
-
* @version 2.0.
|
|
14
|
+
* @version 2.0.7
|
|
15
15
|
* @author Roy Revelt, Codsen Ltd
|
|
16
16
|
* @license MIT
|
|
17
17
|
* {@link https://codsen.com/os/ast-monkey-util/}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
/**
|
|
20
20
|
* @name ast-monkey-traverse
|
|
21
21
|
* @fileoverview Utility library to traverse AST
|
|
22
|
-
* @version 3.0.
|
|
22
|
+
* @version 3.0.7
|
|
23
23
|
* @author Roy Revelt, Codsen Ltd
|
|
24
24
|
* @license MIT
|
|
25
25
|
* {@link https://codsen.com/os/ast-monkey-traverse/}
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
/**
|
|
28
28
|
* @name ast-contains-only-empty-space
|
|
29
29
|
* @fileoverview Does AST contain only empty space?
|
|
30
|
-
* @version 3.0.
|
|
30
|
+
* @version 3.0.7
|
|
31
31
|
* @author Roy Revelt, Codsen Ltd
|
|
32
32
|
* @license MIT
|
|
33
33
|
* {@link https://codsen.com/os/ast-contains-only-empty-space/}
|
|
34
34
|
*/
|
|
35
|
-
function 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.
|
|
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.7",Object.defineProperty(t,"__esModule",{value:!0})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ast-loose-compare",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.7",
|
|
4
4
|
"description": "Compare anything: AST, objects, arrays and strings",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"array",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
89
|
"@babel/runtime": "^7.16.3",
|
|
90
|
-
"ast-contains-only-empty-space": "^3.0.
|
|
90
|
+
"ast-contains-only-empty-space": "^3.0.7",
|
|
91
91
|
"lodash.isplainobject": "^4.0.6"
|
|
92
92
|
},
|
|
93
93
|
"devDependencies": {
|
|
@@ -111,21 +111,21 @@
|
|
|
111
111
|
"@rollup/plugin-strip": "^2.1.0",
|
|
112
112
|
"@rollup/plugin-typescript": "^8.3.0",
|
|
113
113
|
"@types/lodash.isplainobject": "^4.0.6",
|
|
114
|
-
"@types/node": "^16.11.
|
|
114
|
+
"@types/node": "^16.11.10",
|
|
115
115
|
"@types/tap": "^15.0.5",
|
|
116
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
117
|
-
"@typescript-eslint/parser": "^5.
|
|
118
|
-
"core-js": "^3.19.
|
|
116
|
+
"@typescript-eslint/eslint-plugin": "^5.5.0",
|
|
117
|
+
"@typescript-eslint/parser": "^5.5.0",
|
|
118
|
+
"core-js": "^3.19.2",
|
|
119
119
|
"cross-env": "^7.0.3",
|
|
120
120
|
"eslint": "^8.3.0",
|
|
121
|
-
"lect": "^0.18.
|
|
122
|
-
"rollup": "^2.60.
|
|
121
|
+
"lect": "^0.18.7",
|
|
122
|
+
"rollup": "^2.60.1",
|
|
123
123
|
"rollup-plugin-ascii": "^0.0.3",
|
|
124
124
|
"rollup-plugin-banner": "^0.2.1",
|
|
125
125
|
"rollup-plugin-cleanup": "^3.2.1",
|
|
126
126
|
"rollup-plugin-dts": "^4.0.1",
|
|
127
127
|
"rollup-plugin-terser": "^7.0.2",
|
|
128
|
-
"tap": "^15.1.
|
|
128
|
+
"tap": "^15.1.5",
|
|
129
129
|
"tslib": "^2.3.1",
|
|
130
130
|
"typescript": "^4.5.2"
|
|
131
131
|
},
|