ast-get-values-by-key 5.0.18 → 5.0.22
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 +1 -1
- package/README.md +1 -1
- package/dist/ast-get-values-by-key.esm.js +2 -2
- package/dist/ast-get-values-by-key.umd.js +5 -5
- package/package.json +5 -5
- package/types/index.d.ts +2 -1
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2010-
|
|
3
|
+
Copyright (c) 2010-2025 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
|
@@ -103,6 +103,6 @@ To report bugs or request features or assistance, [raise an issue](https://githu
|
|
|
103
103
|
|
|
104
104
|
MIT License.
|
|
105
105
|
|
|
106
|
-
Copyright © 2010-
|
|
106
|
+
Copyright © 2010-2025 Roy Revelt and other contributors.
|
|
107
107
|
|
|
108
108
|
<p align="center"><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"></p>
|
|
@@ -1,10 +1,10 @@
|
|
|
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 5.0.
|
|
4
|
+
* @version 5.0.22
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/ast-get-values-by-key/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import{traverse as m}from"ast-monkey-traverse";import{isMatch as y}from"matcher";import f from"rfdc";var i="5.0.
|
|
10
|
+
import{traverse as m}from"ast-monkey-traverse";import{isMatch as y}from"matcher";import f from"rfdc";var i="5.0.22";var p=f(),k=i;function j(o,d,t){let e;t!==void 0&&(e=Array.isArray(t)?p(t):[p(t)]);let r=[],l=m(o,(n,s,u)=>{let c=s!==void 0?s:n;if(s!==void 0&&y(n,d,{caseSensitive:!0})){if(e===void 0)r.push({val:s,path:u.path});else if(e.length)return e.shift()}return c});return e===void 0?r:l}export{j as getByKey,k as version};
|
|
@@ -1,17 +1,17 @@
|
|
|
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 5.0.
|
|
4
|
+
* @version 5.0.22
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/ast-get-values-by-key/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
"use strict";var astGetValuesByKey=(()=>{var
|
|
10
|
+
"use strict";var astGetValuesByKey=(()=>{var H=Object.create;var g=Object.defineProperty,K=Object.defineProperties,V=Object.getOwnPropertyDescriptor,Q=Object.getOwnPropertyDescriptors,U=Object.getOwnPropertyNames,$=Object.getOwnPropertySymbols,J=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable;var S=(e,t,s)=>t in e?g(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,h=(e,t)=>{for(var s in t||(t={}))C.call(t,s)&&S(e,s,t[s]);if($)for(var s of $(t))W.call(t,s)&&S(e,s,t[s]);return e},b=(e,t)=>K(e,Q(t));var q=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),z=(e,t)=>{for(var s in t)g(e,s,{get:t[s],enumerable:!0})},B=(e,t,s,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of U(t))!C.call(e,c)&&c!==s&&g(e,c,{get:()=>t[c],enumerable:!(l=V(t,c))||l.enumerable});return e};var x=(e,t,s)=>(s=e!=null?H(J(e)):{},B(t||!e||!e.__esModule?g(s,"default",{value:e,enumerable:!0}):s,e)),Z=e=>B(g({},"__esModule",{value:!0}),e);var A=q((ie,D)=>{"use strict";D.exports=_;function m(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}function _(e){if(e=e||{},e.circles)return G(e);let t=new Map;if(t.set(Date,o=>new Date(o)),t.set(Map,(o,a)=>new Map(l(Array.from(o),a))),t.set(Set,(o,a)=>new Set(l(Array.from(o),a))),e.constructorHandlers)for(let o of e.constructorHandlers)t.set(o[0],o[1]);let s=null;return e.proto?p:c;function l(o,a){let r=Object.keys(o),n=new Array(r.length);for(let u=0;u<r.length;u++){let i=r[u],f=o[i];typeof f!="object"||f===null?n[i]=f:f.constructor!==Object&&(s=t.get(f.constructor))?n[i]=s(f,a):ArrayBuffer.isView(f)?n[i]=m(f):n[i]=a(f)}return n}function c(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return l(o,c);if(o.constructor!==Object&&(s=t.get(o.constructor)))return s(o,c);let a={};for(let r in o){if(Object.hasOwnProperty.call(o,r)===!1)continue;let n=o[r];typeof n!="object"||n===null?a[r]=n:n.constructor!==Object&&(s=t.get(n.constructor))?a[r]=s(n,c):ArrayBuffer.isView(n)?a[r]=m(n):a[r]=c(n)}return a}function p(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return l(o,p);if(o.constructor!==Object&&(s=t.get(o.constructor)))return s(o,p);let a={};for(let r in o){let n=o[r];typeof n!="object"||n===null?a[r]=n:n.constructor!==Object&&(s=t.get(n.constructor))?a[r]=s(n,p):ArrayBuffer.isView(n)?a[r]=m(n):a[r]=p(n)}return a}}function G(e){let t=[],s=[],l=new Map;if(l.set(Date,r=>new Date(r)),l.set(Map,(r,n)=>new Map(p(Array.from(r),n))),l.set(Set,(r,n)=>new Set(p(Array.from(r),n))),e.constructorHandlers)for(let r of e.constructorHandlers)l.set(r[0],r[1]);let c=null;return e.proto?a:o;function p(r,n){let u=Object.keys(r),i=new Array(u.length);for(let f=0;f<u.length;f++){let d=u[f],y=r[d];if(typeof y!="object"||y===null)i[d]=y;else if(y.constructor!==Object&&(c=l.get(y.constructor)))i[d]=c(y,n);else if(ArrayBuffer.isView(y))i[d]=m(y);else{let k=t.indexOf(y);k!==-1?i[d]=s[k]:i[d]=n(y)}}return i}function o(r){if(typeof r!="object"||r===null)return r;if(Array.isArray(r))return p(r,o);if(r.constructor!==Object&&(c=l.get(r.constructor)))return c(r,o);let n={};t.push(r),s.push(n);for(let u in r){if(Object.hasOwnProperty.call(r,u)===!1)continue;let i=r[u];if(typeof i!="object"||i===null)n[u]=i;else if(i.constructor!==Object&&(c=l.get(i.constructor)))n[u]=c(i,o);else if(ArrayBuffer.isView(i))n[u]=m(i);else{let f=t.indexOf(i);f!==-1?n[u]=s[f]:n[u]=o(i)}}return t.pop(),s.pop(),n}function a(r){if(typeof r!="object"||r===null)return r;if(Array.isArray(r))return p(r,a);if(r.constructor!==Object&&(c=l.get(r.constructor)))return c(r,a);let n={};t.push(r),s.push(n);for(let u in r){let i=r[u];if(typeof i!="object"||i===null)n[u]=i;else if(i.constructor!==Object&&(c=l.get(i.constructor)))n[u]=c(i,a);else if(ArrayBuffer.isView(i))n[u]=m(i);else{let f=t.indexOf(i);f!==-1?n[u]=s[f]:n[u]=a(i)}}return t.pop(),s.pop(),n}}});var ne={};z(ne,{getByKey:()=>re,version:()=>te});var M=x(A(),1);var E=x(A(),1);var oe=(0,E.default)();function N(e){if(e==null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null?!1:!(Symbol.iterator in e)&&!(Symbol.toStringTag in e)}function w(e){if(e.includes(".")){let t=e.lastIndexOf(".");if(!e.slice(0,t).includes("."))return e.slice(0,t);for(let s=t-1;s--;)if(e[s]===".")return e.slice(s+1,t)}return null}var v=(0,M.default)();function T(e,t){let s={now:!1};function l(c,p,o,a){let r=v(c),n,u=h({depth:-1,path:""},o);if(u.depth+=1,Array.isArray(r))for(let i=0,f=r.length;i<f&&!a.now;i++){let d=u.path?`${u.path}.${i}`:`${i}`;r[i]!==void 0?(u.parent=v(r),u.parentType="array",u.parentKey=w(d),n=l(p(r[i],void 0,b(h({},u),{path:d}),a),p,b(h({},u),{path:d}),a),Number.isNaN(n)&&i<r.length?(r.splice(i,1),i-=1):r[i]=n):r.splice(i,1)}else if(N(r))for(let i in r){if(a.now&&i!=null)break;let f=u.path?`${u.path}.${i}`:i;u.depth===0&&i!=null&&(u.topmostKey=i),u.parent=v(r),u.parentType="object",u.parentKey=w(f),n=l(p(i,r[i],b(h({},u),{path:f}),a),p,b(h({},u),{path:f}),a),Number.isNaN(n)?delete r[i]:r[i]=n}return r}return l(e,t,{},s)}function j(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var O=new Map,F=(e,t)=>{if(!Array.isArray(e))switch(typeof e){case"string":e=[e];break;case"undefined":e=[];break;default:throw new TypeError(`Expected '${t}' to be a string or an array, but got a type of '${typeof e}'`)}return e.filter(s=>{if(typeof s!="string"){if(typeof s>"u")return!1;throw new TypeError(`Expected '${t}' to be an array of strings, but found a type of '${typeof s}' in the array`)}return!0})},X=(e,t)=>{t=h({caseSensitive:!1},t);let s=e+JSON.stringify(t);if(O.has(s))return O.get(s);let l=e[0]==="!";l&&(e=e.slice(1)),e=j(e).replace(/\\\*/g,"[\\s\\S]*");let c=new RegExp(`^${e}$`,t.caseSensitive?"":"i");return c.negated=l,O.set(s,c),c},Y=(e,t,s,l)=>{if(e=F(e,"inputs"),t=F(t,"patterns"),t.length===0)return[];t=t.map(o=>X(o,s));let{allPatterns:c}=s||{},p=[];for(let o of e){let a,r=[...t].fill(!1);for(let[n,u]of t.entries())if(u.test(o)&&(r[n]=!0,a=!u.negated,!a))break;if(!(a===!1||a===void 0&&t.some(n=>!n.negated)||c&&r.some((n,u)=>!n&&!t[u].negated))&&(p.push(o),l))break}return p};function I(e,t,s){return Y(e,t,s,!0).length>0}var L=x(A(),1);var P="5.0.22";var R=(0,L.default)(),te=P;function re(e,t,s){let l;s!==void 0&&(l=Array.isArray(s)?R(s):[R(s)]);let c=[],p=T(e,(o,a,r)=>{let n=a!==void 0?a:o;if(a!==void 0&&I(o,t,{caseSensitive:!0})){if(l===void 0)c.push({val:a,path:r.path});else if(l.length)return l.shift()}return n});return l===void 0?c:p}return Z(ne);})();
|
|
11
11
|
/**
|
|
12
12
|
* @name codsen-utils
|
|
13
13
|
* @fileoverview Various utility functions
|
|
14
|
-
* @version 1.6.
|
|
14
|
+
* @version 1.6.8
|
|
15
15
|
* @author Roy Revelt, Codsen Ltd
|
|
16
16
|
* @license MIT
|
|
17
17
|
* {@link https://codsen.com/os/codsen-utils/}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
/**
|
|
20
20
|
* @name ast-monkey-util
|
|
21
21
|
* @fileoverview Utility library of AST helper functions
|
|
22
|
-
* @version 3.0.
|
|
22
|
+
* @version 3.0.10
|
|
23
23
|
* @author Roy Revelt, Codsen Ltd
|
|
24
24
|
* @license MIT
|
|
25
25
|
* {@link https://codsen.com/os/ast-monkey-util/}
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
/**
|
|
28
28
|
* @name ast-monkey-traverse
|
|
29
29
|
* @fileoverview Utility library to traverse AST
|
|
30
|
-
* @version 4.0.
|
|
30
|
+
* @version 4.0.20
|
|
31
31
|
* @author Roy Revelt, Codsen Ltd
|
|
32
32
|
* @license MIT
|
|
33
33
|
* {@link https://codsen.com/os/ast-monkey-traverse/}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ast-get-values-by-key",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.22",
|
|
4
4
|
"description": "Extract values and paths from AST by keys OR set them by keys",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ast",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"homepage": "https://codsen.com/os/ast-get-values-by-key",
|
|
28
28
|
"repository": {
|
|
29
29
|
"type": "git",
|
|
30
|
-
"url": "https://github.com/codsen/codsen.git",
|
|
30
|
+
"url": "git+https://github.com/codsen/codsen.git",
|
|
31
31
|
"directory": "packages/ast-get-values-by-key"
|
|
32
32
|
},
|
|
33
33
|
"license": "MIT",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"examples": "node '../../ops/scripts/run-examples.js'",
|
|
54
54
|
"lect": "node '../../ops/lect/lect.js' && npm run prettier -- 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
|
|
55
55
|
"letspublish": "npm publish || :",
|
|
56
|
-
"lint": "eslint . --
|
|
56
|
+
"lint": "eslint . --fix",
|
|
57
57
|
"perf": "node perf/check.js",
|
|
58
58
|
"prep": "echo 'ready'",
|
|
59
59
|
"prettier": "prettier",
|
|
@@ -80,8 +80,8 @@
|
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
82
|
"dependencies": {
|
|
83
|
-
"ast-monkey-traverse": "^4.0.
|
|
83
|
+
"ast-monkey-traverse": "^4.0.20",
|
|
84
84
|
"matcher": "^5.0.0",
|
|
85
|
-
"rfdc": "^1.
|
|
85
|
+
"rfdc": "^1.4.1"
|
|
86
86
|
}
|
|
87
87
|
}
|
package/types/index.d.ts
CHANGED