ast-monkey-traverse 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-monkey-traverse
|
|
3
3
|
* @fileoverview Utility library to traverse AST
|
|
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-monkey-traverse/}
|
|
@@ -11,7 +11,7 @@ import clone from 'lodash.clonedeep';
|
|
|
11
11
|
import isObj from 'lodash.isplainobject';
|
|
12
12
|
import { parent } from 'ast-monkey-util';
|
|
13
13
|
|
|
14
|
-
var version$1 = "3.0.
|
|
14
|
+
var version$1 = "3.0.7";
|
|
15
15
|
|
|
16
16
|
const version = version$1;
|
|
17
17
|
function traverse(tree1, cb1) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name ast-monkey-traverse
|
|
3
3
|
* @fileoverview Utility library to traverse AST
|
|
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-monkey-traverse/}
|
|
@@ -11,8 +11,8 @@
|
|
|
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/}
|
|
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}t.traverse=function(t,e){return function t(e,r,o,c){const u=n(e);let a;const i={depth:-1,path:"",...o};if(i.depth+=1,Array.isArray(u))for(let e=0,o=u.length;e<o&&!c.now;e++){const o=i.path?`${i.path}.${e}`:`${e}`;void 0!==u[e]?(i.parent=n(u),i.parentType="array",i.parentKey=y(o),a=t(r(u[e],void 0,{...i,path:o},c),r,{...i,path:o},c),Number.isNaN(a)&&e<u.length?(u.splice(e,1),e-=1):u[e]=a):u.splice(e,1)}else if(p(u))for(const e in u){if(c.now&&null!=e)break;const o=i.path?`${i.path}.${e}`:e;0===i.depth&&null!=e&&(i.topmostKey=e),i.parent=n(u),i.parentType="object",i.parentKey=y(o),a=t(r(e,u[e],{...i,path:o},c),r,{...i,path:o},c),Number.isNaN(a)?delete u[e]:u[e]=a}return u}(t,e,{},{now:!1})},t.version="3.0.
|
|
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}t.traverse=function(t,e){return function t(e,r,o,c){const u=n(e);let a;const i={depth:-1,path:"",...o};if(i.depth+=1,Array.isArray(u))for(let e=0,o=u.length;e<o&&!c.now;e++){const o=i.path?`${i.path}.${e}`:`${e}`;void 0!==u[e]?(i.parent=n(u),i.parentType="array",i.parentKey=y(o),a=t(r(u[e],void 0,{...i,path:o},c),r,{...i,path:o},c),Number.isNaN(a)&&e<u.length?(u.splice(e,1),e-=1):u[e]=a):u.splice(e,1)}else if(p(u))for(const e in u){if(c.now&&null!=e)break;const o=i.path?`${i.path}.${e}`:e;0===i.depth&&null!=e&&(i.topmostKey=e),i.parent=n(u),i.parentType="object",i.parentKey=y(o),a=t(r(e,u[e],{...i,path:o},c),r,{...i,path:o},c),Number.isNaN(a)?delete u[e]:u[e]=a}return u}(t,e,{},{now:!1})},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-monkey-traverse",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.7",
|
|
4
4
|
"description": "Utility library to traverse AST",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ast",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
},
|
|
92
92
|
"dependencies": {
|
|
93
93
|
"@babel/runtime": "^7.16.3",
|
|
94
|
-
"ast-monkey-util": "^2.0.
|
|
94
|
+
"ast-monkey-util": "^2.0.7",
|
|
95
95
|
"lodash.clonedeep": "^4.5.0",
|
|
96
96
|
"lodash.isplainobject": "^4.0.6"
|
|
97
97
|
},
|
|
@@ -117,23 +117,23 @@
|
|
|
117
117
|
"@rollup/plugin-typescript": "^8.3.0",
|
|
118
118
|
"@types/lodash.clonedeep": "^4.5.6",
|
|
119
119
|
"@types/lodash.isplainobject": "^4.0.6",
|
|
120
|
-
"@types/node": "^16.11.
|
|
120
|
+
"@types/node": "^16.11.10",
|
|
121
121
|
"@types/tap": "^15.0.5",
|
|
122
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
123
|
-
"@typescript-eslint/parser": "^5.
|
|
124
|
-
"core-js": "^3.19.
|
|
122
|
+
"@typescript-eslint/eslint-plugin": "^5.5.0",
|
|
123
|
+
"@typescript-eslint/parser": "^5.5.0",
|
|
124
|
+
"core-js": "^3.19.2",
|
|
125
125
|
"cross-env": "^7.0.3",
|
|
126
126
|
"eslint": "^8.3.0",
|
|
127
|
-
"lect": "^0.18.
|
|
127
|
+
"lect": "^0.18.7",
|
|
128
128
|
"lodash.isequal": "^4.5.0",
|
|
129
129
|
"object-path": "^0.11.8",
|
|
130
|
-
"rollup": "^2.60.
|
|
130
|
+
"rollup": "^2.60.1",
|
|
131
131
|
"rollup-plugin-ascii": "^0.0.3",
|
|
132
132
|
"rollup-plugin-banner": "^0.2.1",
|
|
133
133
|
"rollup-plugin-cleanup": "^3.2.1",
|
|
134
134
|
"rollup-plugin-dts": "^4.0.1",
|
|
135
135
|
"rollup-plugin-terser": "^7.0.2",
|
|
136
|
-
"tap": "^15.1.
|
|
136
|
+
"tap": "^15.1.5",
|
|
137
137
|
"tslib": "^2.3.1",
|
|
138
138
|
"typescript": "^4.5.2"
|
|
139
139
|
},
|