ast-get-values-by-key 4.0.6 → 4.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-get-values-by-key
3
3
  * @fileoverview Extract values and paths from AST by keys OR set them by keys
4
- * @version 4.0.6
4
+ * @version 4.0.7
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/ast-get-values-by-key/}
@@ -11,7 +11,7 @@ import { traverse } from 'ast-monkey-traverse';
11
11
  import { isMatch } from 'matcher';
12
12
  import clone from 'lodash.clonedeep';
13
13
 
14
- var version$1 = "4.0.6";
14
+ var version$1 = "4.0.7";
15
15
 
16
16
  const version = version$1;
17
17
  function getByKey(originalInput, whatToFind, originalReplacement) {
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @name ast-get-values-by-key
3
3
  * @fileoverview Extract values and paths from AST by keys OR set them by keys
4
- * @version 4.0.6
4
+ * @version 4.0.7
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/ast-get-values-by-key/}
@@ -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.6
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,8 +19,8 @@
19
19
  /**
20
20
  * @name ast-monkey-traverse
21
21
  * @fileoverview Utility library to traverse AST
22
- * @version 3.0.6
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/}
26
- */const h=new Map,d=(t,e)=>{if(!Array.isArray(t))switch(typeof t){case"string":t=[t];break;case"undefined":t=[];break;default:throw new TypeError(`Expected '${e}' to be a string or an array, but got a type of '${typeof t}'`)}return t.filter((t=>{if("string"!=typeof t){if(void 0===t)return!1;throw new TypeError(`Expected '${e}' to be an array of strings, but found a type of '${typeof t}' in the array`)}return!0}))},v=(t,e)=>{e={caseSensitive:!1,...e};const r=t+JSON.stringify(e);if(h.has(r))return h.get(r);const n="!"===t[0];n&&(t=t.slice(1)),t=function(t){if("string"!=typeof t)throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(t).replace(/\\\*/g,"[\\s\\S]*");const o=new RegExp(`^${t}$`,e.caseSensitive?"":"i");return o.negated=n,h.set(r,o),o};function _(t,e,r){return((t,e,r,n)=>{if(t=d(t,"inputs"),0===(e=d(e,"patterns")).length)return[];e=e.map((t=>v(t,r)));const{allPatterns:o}=r||{},c=[];for(const r of t){let t;const a=[...e].fill(!1);for(const[n,o]of e.entries())if(o.test(r)&&(a[n]=!0,t=!o.negated,!t))break;if(!(!1===t||void 0===t&&e.some((t=>!t.negated))||o&&a.some(((t,r)=>!t&&!e[r].negated)))&&(c.push(r),n))break}return c})(t,e,r,!0).length>0}t.getByKey=function(t,e,r){let o;void 0!==r&&(o=Array.isArray(r)?n(r):[n(r)]);const c=[],a=function t(e,r,o,c){const a=n(e);let i;const u={depth:-1,path:"",...o};if(u.depth+=1,Array.isArray(a))for(let e=0,o=a.length;e<o&&!c.now;e++){const o=u.path?`${u.path}.${e}`:`${e}`;void 0!==a[e]?(u.parent=n(a),u.parentType="array",u.parentKey=y(o),i=t(r(a[e],void 0,{...u,path:o},c),r,{...u,path:o},c),Number.isNaN(i)&&e<a.length?(a.splice(e,1),e-=1):a[e]=i):a.splice(e,1)}else if(p(a))for(const e in a){if(c.now&&null!=e)break;const o=u.path?`${u.path}.${e}`:e;0===u.depth&&null!=e&&(u.topmostKey=e),u.parent=n(a),u.parentType="object",u.parentKey=y(o),i=t(r(e,a[e],{...u,path:o},c),r,{...u,path:o},c),Number.isNaN(i)?delete a[e]:a[e]=i}return a}(t,((t,r,n)=>{const a=void 0!==r?r:t;if(void 0!==r&&_(t,e,{caseSensitive:!0}))if(void 0===o)c.push({val:r,path:n.path});else if(o.length)return o.shift();return a}),{},{now:!1});return void 0===o?c:a},t.version="4.0.6",Object.defineProperty(t,"__esModule",{value:!0})}));
26
+ */const h=new Map,d=(t,e)=>{if(!Array.isArray(t))switch(typeof t){case"string":t=[t];break;case"undefined":t=[];break;default:throw new TypeError(`Expected '${e}' to be a string or an array, but got a type of '${typeof t}'`)}return t.filter((t=>{if("string"!=typeof t){if(void 0===t)return!1;throw new TypeError(`Expected '${e}' to be an array of strings, but found a type of '${typeof t}' in the array`)}return!0}))},v=(t,e)=>{e={caseSensitive:!1,...e};const r=t+JSON.stringify(e);if(h.has(r))return h.get(r);const n="!"===t[0];n&&(t=t.slice(1)),t=function(t){if("string"!=typeof t)throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(t).replace(/\\\*/g,"[\\s\\S]*");const o=new RegExp(`^${t}$`,e.caseSensitive?"":"i");return o.negated=n,h.set(r,o),o};function _(t,e,r){return((t,e,r,n)=>{if(t=d(t,"inputs"),0===(e=d(e,"patterns")).length)return[];e=e.map((t=>v(t,r)));const{allPatterns:o}=r||{},c=[];for(const r of t){let t;const a=[...e].fill(!1);for(const[n,o]of e.entries())if(o.test(r)&&(a[n]=!0,t=!o.negated,!t))break;if(!(!1===t||void 0===t&&e.some((t=>!t.negated))||o&&a.some(((t,r)=>!t&&!e[r].negated)))&&(c.push(r),n))break}return c})(t,e,r,!0).length>0}t.getByKey=function(t,e,r){let o;void 0!==r&&(o=Array.isArray(r)?n(r):[n(r)]);const c=[],a=function t(e,r,o,c){const a=n(e);let i;const u={depth:-1,path:"",...o};if(u.depth+=1,Array.isArray(a))for(let e=0,o=a.length;e<o&&!c.now;e++){const o=u.path?`${u.path}.${e}`:`${e}`;void 0!==a[e]?(u.parent=n(a),u.parentType="array",u.parentKey=y(o),i=t(r(a[e],void 0,{...u,path:o},c),r,{...u,path:o},c),Number.isNaN(i)&&e<a.length?(a.splice(e,1),e-=1):a[e]=i):a.splice(e,1)}else if(p(a))for(const e in a){if(c.now&&null!=e)break;const o=u.path?`${u.path}.${e}`:e;0===u.depth&&null!=e&&(u.topmostKey=e),u.parent=n(a),u.parentType="object",u.parentKey=y(o),i=t(r(e,a[e],{...u,path:o},c),r,{...u,path:o},c),Number.isNaN(i)?delete a[e]:a[e]=i}return a}(t,((t,r,n)=>{const a=void 0!==r?r:t;if(void 0!==r&&_(t,e,{caseSensitive:!0}))if(void 0===o)c.push({val:r,path:n.path});else if(o.length)return o.shift();return a}),{},{now:!1});return void 0===o?c:a},t.version="4.0.7",Object.defineProperty(t,"__esModule",{value:!0})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ast-get-values-by-key",
3
- "version": "4.0.6",
3
+ "version": "4.0.7",
4
4
  "description": "Extract values and paths from AST by keys OR set them by keys",
5
5
  "keywords": [
6
6
  "ast",
@@ -89,7 +89,7 @@
89
89
  },
90
90
  "dependencies": {
91
91
  "@babel/runtime": "^7.16.3",
92
- "ast-monkey-traverse": "^3.0.6",
92
+ "ast-monkey-traverse": "^3.0.7",
93
93
  "lodash.clonedeep": "^4.5.0",
94
94
  "matcher": "^5.0.0"
95
95
  },
@@ -114,22 +114,22 @@
114
114
  "@rollup/plugin-strip": "^2.1.0",
115
115
  "@rollup/plugin-typescript": "^8.3.0",
116
116
  "@types/lodash.clonedeep": "^4.5.6",
117
- "@types/node": "^16.11.9",
117
+ "@types/node": "^16.11.10",
118
118
  "@types/tap": "^15.0.5",
119
- "@typescript-eslint/eslint-plugin": "^5.4.0",
120
- "@typescript-eslint/parser": "^5.4.0",
121
- "core-js": "^3.19.1",
119
+ "@typescript-eslint/eslint-plugin": "^5.5.0",
120
+ "@typescript-eslint/parser": "^5.5.0",
121
+ "core-js": "^3.19.2",
122
122
  "cross-env": "^7.0.3",
123
123
  "eslint": "^8.3.0",
124
- "lect": "^0.18.6",
124
+ "lect": "^0.18.7",
125
125
  "object-path": "^0.11.8",
126
- "rollup": "^2.60.0",
126
+ "rollup": "^2.60.1",
127
127
  "rollup-plugin-ascii": "^0.0.3",
128
128
  "rollup-plugin-banner": "^0.2.1",
129
129
  "rollup-plugin-cleanup": "^3.2.1",
130
130
  "rollup-plugin-dts": "^4.0.1",
131
131
  "rollup-plugin-terser": "^7.0.2",
132
- "tap": "^15.1.2",
132
+ "tap": "^15.1.5",
133
133
  "tslib": "^2.3.1",
134
134
  "typescript": "^4.5.2"
135
135
  },