@aws-lambda-powertools/jmespath 2.26.1 → 2.28.0
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/README.md +4 -4
- package/lib/cjs/Expression.d.ts +2 -3
- package/lib/cjs/Expression.d.ts.map +1 -1
- package/lib/cjs/Expression.js +2 -3
- package/lib/cjs/Functions.d.ts +36 -36
- package/lib/cjs/Functions.js +36 -36
- package/lib/cjs/Lexer.js +2 -2
- package/lib/cjs/ParsedResult.d.ts +2 -2
- package/lib/cjs/ParsedResult.js +2 -2
- package/lib/cjs/Parser.d.ts +1 -2
- package/lib/cjs/Parser.d.ts.map +1 -1
- package/lib/cjs/Parser.js +42 -23
- package/lib/cjs/PowertoolsFunctions.d.ts +3 -5
- package/lib/cjs/PowertoolsFunctions.d.ts.map +1 -1
- package/lib/cjs/PowertoolsFunctions.js +4 -6
- package/lib/cjs/TreeInterpreter.js +2 -2
- package/lib/cjs/ast.d.ts +35 -33
- package/lib/cjs/ast.d.ts.map +1 -1
- package/lib/cjs/ast.js +35 -33
- package/lib/cjs/constants.d.ts.map +1 -1
- package/lib/cjs/envelopes.d.ts +3 -3
- package/lib/cjs/envelopes.js +3 -3
- package/lib/cjs/errors.d.ts +11 -2
- package/lib/cjs/errors.d.ts.map +1 -1
- package/lib/cjs/errors.js +11 -2
- package/lib/cjs/search.d.ts +3 -3
- package/lib/cjs/search.js +3 -3
- package/lib/cjs/types.d.ts +2 -2
- package/lib/cjs/utils.d.ts +24 -24
- package/lib/cjs/utils.js +46 -46
- package/lib/esm/Expression.d.ts +2 -3
- package/lib/esm/Expression.d.ts.map +1 -1
- package/lib/esm/Expression.js +2 -3
- package/lib/esm/Functions.d.ts +36 -36
- package/lib/esm/Functions.js +36 -36
- package/lib/esm/Lexer.js +2 -2
- package/lib/esm/ParsedResult.d.ts +2 -2
- package/lib/esm/ParsedResult.js +2 -2
- package/lib/esm/Parser.d.ts +1 -2
- package/lib/esm/Parser.d.ts.map +1 -1
- package/lib/esm/Parser.js +42 -23
- package/lib/esm/PowertoolsFunctions.d.ts +3 -5
- package/lib/esm/PowertoolsFunctions.d.ts.map +1 -1
- package/lib/esm/PowertoolsFunctions.js +3 -5
- package/lib/esm/TreeInterpreter.js +2 -2
- package/lib/esm/ast.d.ts +35 -33
- package/lib/esm/ast.d.ts.map +1 -1
- package/lib/esm/ast.js +35 -33
- package/lib/esm/constants.d.ts.map +1 -1
- package/lib/esm/envelopes.d.ts +3 -3
- package/lib/esm/envelopes.js +3 -3
- package/lib/esm/errors.d.ts +11 -2
- package/lib/esm/errors.d.ts.map +1 -1
- package/lib/esm/errors.js +11 -2
- package/lib/esm/search.d.ts +3 -3
- package/lib/esm/search.js +3 -3
- package/lib/esm/types.d.ts +2 -2
- package/lib/esm/utils.d.ts +24 -24
- package/lib/esm/utils.js +46 -46
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Powertools for AWS Lambda (TypeScript) - JMESPath Utility <!-- omit in toc -->
|
|
2
2
|
|
|
3
|
-
Powertools for AWS Lambda (TypeScript) is a developer toolkit to implement Serverless [best practices and increase developer velocity](https://docs.
|
|
3
|
+
Powertools for AWS Lambda (TypeScript) is a developer toolkit to implement Serverless [best practices and increase developer velocity](https://docs.aws.amazon.com/powertools/typescript/latest/#features).
|
|
4
4
|
|
|
5
5
|
You can use the package in both TypeScript and JavaScript code bases.
|
|
6
6
|
|
|
@@ -90,7 +90,7 @@ export const handler = async (event: MyEvent): Promise<unknown> => {
|
|
|
90
90
|
};
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
-
The library provides [a set of built-in envelopes](https://docs.
|
|
93
|
+
The library provides [a set of built-in envelopes](https://docs.aws.amazon.com/powertools/typescript/latest/features/jmespath/#built-in-envelopes) to help you extract data from common event sources, such as S3, SQS, and SNS, and more.
|
|
94
94
|
|
|
95
95
|
```ts
|
|
96
96
|
import {
|
|
@@ -216,11 +216,11 @@ The following companies, among others, use Powertools:
|
|
|
216
216
|
|
|
217
217
|
### Sharing your work
|
|
218
218
|
|
|
219
|
-
Share what you did with Powertools for AWS Lambda (TypeScript) 💞💞. Blog post, workshops, presentation, sample apps and others. Check out what the community has [already shared](https://docs.
|
|
219
|
+
Share what you did with Powertools for AWS Lambda (TypeScript) 💞💞. Blog post, workshops, presentation, sample apps and others. Check out what the community has [already shared](https://docs.aws.amazon.com/powertools/typescript/latest/we_made_this) about Powertools for AWS Lambda (TypeScript).
|
|
220
220
|
|
|
221
221
|
### Using Lambda Layer
|
|
222
222
|
|
|
223
|
-
This helps us understand who uses Powertools for AWS Lambda (TypeScript) in a non-intrusive way, and helps us gain future investments for other Powertools for AWS Lambda languages. When [using Layers](https://docs.
|
|
223
|
+
This helps us understand who uses Powertools for AWS Lambda (TypeScript) in a non-intrusive way, and helps us gain future investments for other Powertools for AWS Lambda languages. When [using Layers](https://docs.aws.amazon.com/powertools/typescript/latest/getting-started/lambda-layers/), you can add Powertools as a dev dependency to not impact the development process.
|
|
224
224
|
|
|
225
225
|
## License
|
|
226
226
|
|
package/lib/cjs/Expression.d.ts
CHANGED
|
@@ -9,9 +9,8 @@ declare class Expression {
|
|
|
9
9
|
/**
|
|
10
10
|
* Evaluate the expression against a JSON value.
|
|
11
11
|
*
|
|
12
|
-
* @param value The JSON value to apply the expression to.
|
|
13
|
-
* @param node The node to visit.
|
|
14
|
-
* @returns The result of applying the expression to the value.
|
|
12
|
+
* @param value - The JSON value to apply the expression to.
|
|
13
|
+
* @param node - The node to visit.
|
|
15
14
|
*/
|
|
16
15
|
visit(value: JSONObject, node?: Node): JSONObject;
|
|
17
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Expression.d.ts","sourceRoot":"","sources":["../../src/Expression.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEnD;;GAEG;AACH,cAAM,UAAU;;gBAIK,UAAU,EAAE,IAAI,EAAE,WAAW,EAAE,eAAe;IAKjE
|
|
1
|
+
{"version":3,"file":"Expression.d.ts","sourceRoot":"","sources":["../../src/Expression.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEnD;;GAEG;AACH,cAAM,UAAU;;gBAIK,UAAU,EAAE,IAAI,EAAE,WAAW,EAAE,eAAe;IAKjE;;;;;OAKG;IACI,KAAK,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG,UAAU;CAGzD;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
package/lib/cjs/Expression.js
CHANGED
|
@@ -14,9 +14,8 @@ class Expression {
|
|
|
14
14
|
/**
|
|
15
15
|
* Evaluate the expression against a JSON value.
|
|
16
16
|
*
|
|
17
|
-
* @param value The JSON value to apply the expression to.
|
|
18
|
-
* @param node The node to visit.
|
|
19
|
-
* @returns The result of applying the expression to the value.
|
|
17
|
+
* @param value - The JSON value to apply the expression to.
|
|
18
|
+
* @param node - The node to visit.
|
|
20
19
|
*/
|
|
21
20
|
visit(value, node) {
|
|
22
21
|
return this.#interpreter.visit(node ?? this.#expression, value);
|
package/lib/cjs/Functions.d.ts
CHANGED
|
@@ -39,78 +39,78 @@ declare class Functions {
|
|
|
39
39
|
/**
|
|
40
40
|
* Get the absolute value of the provided number.
|
|
41
41
|
*
|
|
42
|
-
* @param args The number to get the absolute value of
|
|
42
|
+
* @param args - The number to get the absolute value of
|
|
43
43
|
*/
|
|
44
44
|
funcAbs(args: number): number;
|
|
45
45
|
/**
|
|
46
46
|
* Calculate the average of the numbers in the provided array.
|
|
47
47
|
*
|
|
48
|
-
* @param args The numbers to average
|
|
48
|
+
* @param args - The numbers to average
|
|
49
49
|
*/
|
|
50
50
|
funcAvg(args: Array<number>): number;
|
|
51
51
|
/**
|
|
52
52
|
* Get the ceiling of the provided number.
|
|
53
53
|
*
|
|
54
|
-
* @param args The number to get the ceiling of
|
|
54
|
+
* @param args - The number to get the ceiling of
|
|
55
55
|
*/
|
|
56
56
|
funcCeil(args: number): number;
|
|
57
57
|
/**
|
|
58
58
|
* Determine if the given value is contained in the provided array or string.
|
|
59
59
|
*
|
|
60
|
-
* @param haystack The array or string to check
|
|
61
|
-
* @param needle The value to check for
|
|
60
|
+
* @param haystack - The array or string to check
|
|
61
|
+
* @param needle - The value to check for
|
|
62
62
|
*/
|
|
63
63
|
funcContains(haystack: string, needle: string): boolean;
|
|
64
64
|
/**
|
|
65
65
|
* Determines if the provided string ends with the provided suffix.
|
|
66
66
|
*
|
|
67
|
-
* @param str The string to check
|
|
68
|
-
* @param suffix The suffix to check for
|
|
67
|
+
* @param str - The string to check
|
|
68
|
+
* @param suffix - The suffix to check for
|
|
69
69
|
*/
|
|
70
70
|
funcEndsWith(str: string, suffix: string): boolean;
|
|
71
71
|
/**
|
|
72
72
|
* Get the floor of the provided number.
|
|
73
73
|
*
|
|
74
|
-
* @param args The number to get the floor of
|
|
74
|
+
* @param args - The number to get the floor of
|
|
75
75
|
*/
|
|
76
76
|
funcFloor(args: number): number;
|
|
77
77
|
/**
|
|
78
78
|
* Join the provided array into a single string.
|
|
79
79
|
*
|
|
80
|
-
* @param separator The separator to use
|
|
81
|
-
* @param items The array of itmes to join
|
|
80
|
+
* @param separator - The separator to use
|
|
81
|
+
* @param items - The array of itmes to join
|
|
82
82
|
*/
|
|
83
83
|
funcJoin(separator: string, items: Array<string>): string;
|
|
84
84
|
/**
|
|
85
85
|
* Get the keys of the provided object.
|
|
86
86
|
*
|
|
87
|
-
* @param arg The object to get the keys of
|
|
87
|
+
* @param arg - The object to get the keys of
|
|
88
88
|
*/
|
|
89
89
|
funcKeys(arg: JSONObject): string[];
|
|
90
90
|
/**
|
|
91
91
|
* Get the number of items in the provided item.
|
|
92
92
|
*
|
|
93
|
-
* @param arg The array to get the length of
|
|
93
|
+
* @param arg - The array to get the length of
|
|
94
94
|
*/
|
|
95
95
|
funcLength(arg: string | Array<unknown> | Record<string, unknown>): number;
|
|
96
96
|
/**
|
|
97
97
|
* Map the provided function over the provided array.
|
|
98
98
|
*
|
|
99
|
-
* @param expression The expression to map over the array
|
|
100
|
-
* @param args The array to map the expression over
|
|
99
|
+
* @param expression - The expression to map over the array
|
|
100
|
+
* @param args - The array to map the expression over
|
|
101
101
|
*/
|
|
102
102
|
funcMap(expression: Expression, args: JSONArray): JSONArray | Array<unknown>;
|
|
103
103
|
/**
|
|
104
104
|
* Get the maximum value in the provided array.
|
|
105
105
|
*
|
|
106
|
-
* @param arg The array to get the maximum value of
|
|
106
|
+
* @param arg - The array to get the maximum value of
|
|
107
107
|
*/
|
|
108
108
|
funcMax(arg: Array<number | string>): number | string | null;
|
|
109
109
|
/**
|
|
110
110
|
* Get the item in the provided array that has the maximum value when the provided expression is evaluated.
|
|
111
111
|
*
|
|
112
|
-
* @param args The array of items to get the maximum value of
|
|
113
|
-
* @param expression The expression to evaluate for each item in the array
|
|
112
|
+
* @param args - The array of items to get the maximum value of
|
|
113
|
+
* @param expression - The expression to evaluate for each item in the array
|
|
114
114
|
*/
|
|
115
115
|
funcMaxBy(args: Array<JSONObject>, expression: Expression): JSONObject | null;
|
|
116
116
|
/**
|
|
@@ -118,59 +118,59 @@ declare class Functions {
|
|
|
118
118
|
*
|
|
119
119
|
* Note that this is a shallow merge and will not merge nested objects.
|
|
120
120
|
*
|
|
121
|
-
* @param args The objects to merge
|
|
121
|
+
* @param args - The objects to merge
|
|
122
122
|
*/
|
|
123
123
|
funcMerge(...args: Array<JSONObject>): JSONObject;
|
|
124
124
|
/**
|
|
125
125
|
* Get the minimum value in the provided array.
|
|
126
126
|
*
|
|
127
|
-
* @param arg The array to get the minimum value of
|
|
127
|
+
* @param arg - The array to get the minimum value of
|
|
128
128
|
*/
|
|
129
129
|
funcMin(arg: Array<number>): number | string | null;
|
|
130
130
|
/**
|
|
131
131
|
* Get the item in the provided array that has the minimum value when the provided expression is evaluated.
|
|
132
132
|
*
|
|
133
|
-
* @param args The array of items to get the minimum value of
|
|
134
|
-
* @param expression The expression to evaluate for each item in the array
|
|
133
|
+
* @param args - The array of items to get the minimum value of
|
|
134
|
+
* @param expression - The expression to evaluate for each item in the array
|
|
135
135
|
*/
|
|
136
136
|
funcMinBy(args: Array<JSONObject>, expression: Expression): JSONObject | null;
|
|
137
137
|
/**
|
|
138
138
|
* Get the first argument that does not evaluate to null.
|
|
139
139
|
* If all arguments evaluate to null, then null is returned.
|
|
140
140
|
*
|
|
141
|
-
* @param args The keys of the items to check
|
|
141
|
+
* @param args - The keys of the items to check
|
|
142
142
|
*/
|
|
143
143
|
funcNotNull(...args: Array<JSONValue>): JSONValue | null;
|
|
144
144
|
/**
|
|
145
145
|
* Reverses the provided string or array.
|
|
146
146
|
*
|
|
147
|
-
* @param arg The string or array to reverse
|
|
147
|
+
* @param arg - The string or array to reverse
|
|
148
148
|
*/
|
|
149
149
|
funcReverse(arg: string | Array<unknown>): string | Array<unknown>;
|
|
150
150
|
/**
|
|
151
151
|
* Sort the provided array.
|
|
152
152
|
*
|
|
153
|
-
* @param arg The array to sort
|
|
153
|
+
* @param arg - The array to sort
|
|
154
154
|
*/
|
|
155
155
|
funcSort(arg: Array<string> | Array<number>): Array<unknown>;
|
|
156
156
|
/**
|
|
157
157
|
* Sort the provided array by the provided expression.
|
|
158
158
|
*
|
|
159
|
-
* @param args The array to sort
|
|
160
|
-
* @param expression The expression to sort by
|
|
159
|
+
* @param args - The array to sort
|
|
160
|
+
* @param expression - The expression to sort by
|
|
161
161
|
*/
|
|
162
162
|
funcSortBy(args: Array<JSONValue>, expression: Expression): Array<unknown>;
|
|
163
163
|
/**
|
|
164
164
|
* Determines if the provided string starts with the provided prefix.
|
|
165
165
|
*
|
|
166
|
-
* @param str The string to check
|
|
167
|
-
* @param prefix The prefix to check for
|
|
166
|
+
* @param str - The string to check
|
|
167
|
+
* @param prefix - The prefix to check for
|
|
168
168
|
*/
|
|
169
169
|
funcStartsWith(str: string, prefix: string): boolean;
|
|
170
170
|
/**
|
|
171
171
|
* Sum the provided numbers.
|
|
172
172
|
*
|
|
173
|
-
* @param args The numbers to sum
|
|
173
|
+
* @param args - The numbers to sum
|
|
174
174
|
*/
|
|
175
175
|
funcSum(args: Array<number>): number;
|
|
176
176
|
/**
|
|
@@ -179,7 +179,7 @@ declare class Functions {
|
|
|
179
179
|
* If the provided value is an array, then it is returned.
|
|
180
180
|
* Otherwise, the value is wrapped in an array and returned.
|
|
181
181
|
*
|
|
182
|
-
* @param arg The items to convert to an array
|
|
182
|
+
* @param arg - The items to convert to an array
|
|
183
183
|
*/
|
|
184
184
|
funcToArray(arg: JSONArray | Array<JSONValue>): Array<JSONValue> | JSONArray;
|
|
185
185
|
/**
|
|
@@ -190,7 +190,7 @@ declare class Functions {
|
|
|
190
190
|
*
|
|
191
191
|
* If the value cannot be converted to a number, then null is returned.
|
|
192
192
|
*
|
|
193
|
-
* @param arg The value to convert to a number
|
|
193
|
+
* @param arg - The value to convert to a number
|
|
194
194
|
*/
|
|
195
195
|
funcToNumber(arg: JSONValue): number | null;
|
|
196
196
|
/**
|
|
@@ -199,19 +199,19 @@ declare class Functions {
|
|
|
199
199
|
* If the provided value is a string, then it is returned.
|
|
200
200
|
* Otherwise, the value is converted to a string and returned.
|
|
201
201
|
*
|
|
202
|
-
* @param arg The value to convert to a string
|
|
202
|
+
* @param arg - The value to convert to a string
|
|
203
203
|
*/
|
|
204
204
|
funcToString(arg: JSONValue): string;
|
|
205
205
|
/**
|
|
206
206
|
* Get the type of the provided value.
|
|
207
207
|
*
|
|
208
|
-
* @param arg The value to check the type of
|
|
208
|
+
* @param arg - The value to check the type of
|
|
209
209
|
*/
|
|
210
210
|
funcType(arg: JSONValue): string;
|
|
211
211
|
/**
|
|
212
212
|
* Get the values of the provided object.
|
|
213
213
|
*
|
|
214
|
-
* @param arg The object to get the values of
|
|
214
|
+
* @param arg - The object to get the values of
|
|
215
215
|
*/
|
|
216
216
|
funcValues(arg: JSONObject): JSONValue[];
|
|
217
217
|
/**
|
|
@@ -229,7 +229,7 @@ declare class Functions {
|
|
|
229
229
|
* to the `methods` set. Finally, when the recursion collects back to the current instance,
|
|
230
230
|
* it adds the collected methods to the `this.methods` set so that they can be accessed later.
|
|
231
231
|
*
|
|
232
|
-
* @param scope The scope of the class instance to introspect
|
|
232
|
+
* @param scope - The scope of the class instance to introspect
|
|
233
233
|
*/
|
|
234
234
|
introspectMethods(scope?: Functions): Set<string>;
|
|
235
235
|
/**
|
|
@@ -254,7 +254,7 @@ declare class Functions {
|
|
|
254
254
|
* }
|
|
255
255
|
* ```
|
|
256
256
|
*
|
|
257
|
-
* @param options The options for the signature decorator
|
|
257
|
+
* @param options - The options for the signature decorator
|
|
258
258
|
*/
|
|
259
259
|
static signature(options: FunctionSignatureOptions): FunctionSignatureDecorator;
|
|
260
260
|
}
|
package/lib/cjs/Functions.js
CHANGED
|
@@ -48,7 +48,7 @@ class Functions {
|
|
|
48
48
|
/**
|
|
49
49
|
* Get the absolute value of the provided number.
|
|
50
50
|
*
|
|
51
|
-
* @param args The number to get the absolute value of
|
|
51
|
+
* @param args - The number to get the absolute value of
|
|
52
52
|
*/
|
|
53
53
|
funcAbs(args) {
|
|
54
54
|
return Math.abs(args);
|
|
@@ -56,7 +56,7 @@ class Functions {
|
|
|
56
56
|
/**
|
|
57
57
|
* Calculate the average of the numbers in the provided array.
|
|
58
58
|
*
|
|
59
|
-
* @param args The numbers to average
|
|
59
|
+
* @param args - The numbers to average
|
|
60
60
|
*/
|
|
61
61
|
funcAvg(args) {
|
|
62
62
|
return args.reduce((a, b) => a + b, 0) / args.length;
|
|
@@ -64,7 +64,7 @@ class Functions {
|
|
|
64
64
|
/**
|
|
65
65
|
* Get the ceiling of the provided number.
|
|
66
66
|
*
|
|
67
|
-
* @param args The number to get the ceiling of
|
|
67
|
+
* @param args - The number to get the ceiling of
|
|
68
68
|
*/
|
|
69
69
|
funcCeil(args) {
|
|
70
70
|
return Math.ceil(args);
|
|
@@ -72,8 +72,8 @@ class Functions {
|
|
|
72
72
|
/**
|
|
73
73
|
* Determine if the given value is contained in the provided array or string.
|
|
74
74
|
*
|
|
75
|
-
* @param haystack The array or string to check
|
|
76
|
-
* @param needle The value to check for
|
|
75
|
+
* @param haystack - The array or string to check
|
|
76
|
+
* @param needle - The value to check for
|
|
77
77
|
*/
|
|
78
78
|
funcContains(haystack, needle) {
|
|
79
79
|
return haystack.includes(needle);
|
|
@@ -81,8 +81,8 @@ class Functions {
|
|
|
81
81
|
/**
|
|
82
82
|
* Determines if the provided string ends with the provided suffix.
|
|
83
83
|
*
|
|
84
|
-
* @param str The string to check
|
|
85
|
-
* @param suffix The suffix to check for
|
|
84
|
+
* @param str - The string to check
|
|
85
|
+
* @param suffix - The suffix to check for
|
|
86
86
|
*/
|
|
87
87
|
funcEndsWith(str, suffix) {
|
|
88
88
|
return str.endsWith(suffix);
|
|
@@ -90,7 +90,7 @@ class Functions {
|
|
|
90
90
|
/**
|
|
91
91
|
* Get the floor of the provided number.
|
|
92
92
|
*
|
|
93
|
-
* @param args The number to get the floor of
|
|
93
|
+
* @param args - The number to get the floor of
|
|
94
94
|
*/
|
|
95
95
|
funcFloor(args) {
|
|
96
96
|
return Math.floor(args);
|
|
@@ -98,8 +98,8 @@ class Functions {
|
|
|
98
98
|
/**
|
|
99
99
|
* Join the provided array into a single string.
|
|
100
100
|
*
|
|
101
|
-
* @param separator The separator to use
|
|
102
|
-
* @param items The array of itmes to join
|
|
101
|
+
* @param separator - The separator to use
|
|
102
|
+
* @param items - The array of itmes to join
|
|
103
103
|
*/
|
|
104
104
|
funcJoin(separator, items) {
|
|
105
105
|
return items.join(separator);
|
|
@@ -107,7 +107,7 @@ class Functions {
|
|
|
107
107
|
/**
|
|
108
108
|
* Get the keys of the provided object.
|
|
109
109
|
*
|
|
110
|
-
* @param arg The object to get the keys of
|
|
110
|
+
* @param arg - The object to get the keys of
|
|
111
111
|
*/
|
|
112
112
|
funcKeys(arg) {
|
|
113
113
|
return Object.keys(arg);
|
|
@@ -115,7 +115,7 @@ class Functions {
|
|
|
115
115
|
/**
|
|
116
116
|
* Get the number of items in the provided item.
|
|
117
117
|
*
|
|
118
|
-
* @param arg The array to get the length of
|
|
118
|
+
* @param arg - The array to get the length of
|
|
119
119
|
*/
|
|
120
120
|
funcLength(arg) {
|
|
121
121
|
if ((0, typeutils_1.isRecord)(arg)) {
|
|
@@ -126,8 +126,8 @@ class Functions {
|
|
|
126
126
|
/**
|
|
127
127
|
* Map the provided function over the provided array.
|
|
128
128
|
*
|
|
129
|
-
* @param expression The expression to map over the array
|
|
130
|
-
* @param args The array to map the expression over
|
|
129
|
+
* @param expression - The expression to map over the array
|
|
130
|
+
* @param args - The array to map the expression over
|
|
131
131
|
*/
|
|
132
132
|
funcMap(expression, args) {
|
|
133
133
|
return args.map((arg) => {
|
|
@@ -137,7 +137,7 @@ class Functions {
|
|
|
137
137
|
/**
|
|
138
138
|
* Get the maximum value in the provided array.
|
|
139
139
|
*
|
|
140
|
-
* @param arg The array to get the maximum value of
|
|
140
|
+
* @param arg - The array to get the maximum value of
|
|
141
141
|
*/
|
|
142
142
|
funcMax(arg) {
|
|
143
143
|
if (arg.length === 0) {
|
|
@@ -153,8 +153,8 @@ class Functions {
|
|
|
153
153
|
/**
|
|
154
154
|
* Get the item in the provided array that has the maximum value when the provided expression is evaluated.
|
|
155
155
|
*
|
|
156
|
-
* @param args The array of items to get the maximum value of
|
|
157
|
-
* @param expression The expression to evaluate for each item in the array
|
|
156
|
+
* @param args - The array of items to get the maximum value of
|
|
157
|
+
* @param expression - The expression to evaluate for each item in the array
|
|
158
158
|
*/
|
|
159
159
|
funcMaxBy(args, expression) {
|
|
160
160
|
if (args.length === 0) {
|
|
@@ -190,7 +190,7 @@ class Functions {
|
|
|
190
190
|
*
|
|
191
191
|
* Note that this is a shallow merge and will not merge nested objects.
|
|
192
192
|
*
|
|
193
|
-
* @param args The objects to merge
|
|
193
|
+
* @param args - The objects to merge
|
|
194
194
|
*/
|
|
195
195
|
funcMerge(...args) {
|
|
196
196
|
// biome-ignore lint/performance/noAccumulatingSpread: This is a shallow merge so the tradeoff is acceptable
|
|
@@ -199,7 +199,7 @@ class Functions {
|
|
|
199
199
|
/**
|
|
200
200
|
* Get the minimum value in the provided array.
|
|
201
201
|
*
|
|
202
|
-
* @param arg The array to get the minimum value of
|
|
202
|
+
* @param arg - The array to get the minimum value of
|
|
203
203
|
*/
|
|
204
204
|
funcMin(arg) {
|
|
205
205
|
if (arg.length === 0) {
|
|
@@ -214,8 +214,8 @@ class Functions {
|
|
|
214
214
|
/**
|
|
215
215
|
* Get the item in the provided array that has the minimum value when the provided expression is evaluated.
|
|
216
216
|
*
|
|
217
|
-
* @param args The array of items to get the minimum value of
|
|
218
|
-
* @param expression The expression to evaluate for each item in the array
|
|
217
|
+
* @param args - The array of items to get the minimum value of
|
|
218
|
+
* @param expression - The expression to evaluate for each item in the array
|
|
219
219
|
*/
|
|
220
220
|
funcMinBy(args, expression) {
|
|
221
221
|
if (args.length === 0) {
|
|
@@ -250,7 +250,7 @@ class Functions {
|
|
|
250
250
|
* Get the first argument that does not evaluate to null.
|
|
251
251
|
* If all arguments evaluate to null, then null is returned.
|
|
252
252
|
*
|
|
253
|
-
* @param args The keys of the items to check
|
|
253
|
+
* @param args - The keys of the items to check
|
|
254
254
|
*/
|
|
255
255
|
funcNotNull(...args) {
|
|
256
256
|
return args.find((arg) => !Object.is(arg, null)) || null;
|
|
@@ -258,7 +258,7 @@ class Functions {
|
|
|
258
258
|
/**
|
|
259
259
|
* Reverses the provided string or array.
|
|
260
260
|
*
|
|
261
|
-
* @param arg The string or array to reverse
|
|
261
|
+
* @param arg - The string or array to reverse
|
|
262
262
|
*/
|
|
263
263
|
funcReverse(arg) {
|
|
264
264
|
return Array.isArray(arg)
|
|
@@ -268,7 +268,7 @@ class Functions {
|
|
|
268
268
|
/**
|
|
269
269
|
* Sort the provided array.
|
|
270
270
|
*
|
|
271
|
-
* @param arg The array to sort
|
|
271
|
+
* @param arg - The array to sort
|
|
272
272
|
*/
|
|
273
273
|
funcSort(arg) {
|
|
274
274
|
return arg.sort((a, b) => {
|
|
@@ -286,8 +286,8 @@ class Functions {
|
|
|
286
286
|
/**
|
|
287
287
|
* Sort the provided array by the provided expression.
|
|
288
288
|
*
|
|
289
|
-
* @param args The array to sort
|
|
290
|
-
* @param expression The expression to sort by
|
|
289
|
+
* @param args - The array to sort
|
|
290
|
+
* @param expression - The expression to sort by
|
|
291
291
|
*/
|
|
292
292
|
funcSortBy(args, expression) {
|
|
293
293
|
return args
|
|
@@ -322,8 +322,8 @@ class Functions {
|
|
|
322
322
|
/**
|
|
323
323
|
* Determines if the provided string starts with the provided prefix.
|
|
324
324
|
*
|
|
325
|
-
* @param str The string to check
|
|
326
|
-
* @param prefix The prefix to check for
|
|
325
|
+
* @param str - The string to check
|
|
326
|
+
* @param prefix - The prefix to check for
|
|
327
327
|
*/
|
|
328
328
|
funcStartsWith(str, prefix) {
|
|
329
329
|
return str.startsWith(prefix);
|
|
@@ -331,7 +331,7 @@ class Functions {
|
|
|
331
331
|
/**
|
|
332
332
|
* Sum the provided numbers.
|
|
333
333
|
*
|
|
334
|
-
* @param args The numbers to sum
|
|
334
|
+
* @param args - The numbers to sum
|
|
335
335
|
*/
|
|
336
336
|
funcSum(args) {
|
|
337
337
|
return args.reduce((a, b) => a + b, 0);
|
|
@@ -342,7 +342,7 @@ class Functions {
|
|
|
342
342
|
* If the provided value is an array, then it is returned.
|
|
343
343
|
* Otherwise, the value is wrapped in an array and returned.
|
|
344
344
|
*
|
|
345
|
-
* @param arg The items to convert to an array
|
|
345
|
+
* @param arg - The items to convert to an array
|
|
346
346
|
*/
|
|
347
347
|
funcToArray(arg) {
|
|
348
348
|
return Array.isArray(arg) ? arg : [arg];
|
|
@@ -355,7 +355,7 @@ class Functions {
|
|
|
355
355
|
*
|
|
356
356
|
* If the value cannot be converted to a number, then null is returned.
|
|
357
357
|
*
|
|
358
|
-
* @param arg The value to convert to a number
|
|
358
|
+
* @param arg - The value to convert to a number
|
|
359
359
|
*/
|
|
360
360
|
funcToNumber(arg) {
|
|
361
361
|
if (typeof arg === 'number') {
|
|
@@ -373,7 +373,7 @@ class Functions {
|
|
|
373
373
|
* If the provided value is a string, then it is returned.
|
|
374
374
|
* Otherwise, the value is converted to a string and returned.
|
|
375
375
|
*
|
|
376
|
-
* @param arg The value to convert to a string
|
|
376
|
+
* @param arg - The value to convert to a string
|
|
377
377
|
*/
|
|
378
378
|
funcToString(arg) {
|
|
379
379
|
return typeof arg === 'string' ? arg : JSON.stringify(arg);
|
|
@@ -381,7 +381,7 @@ class Functions {
|
|
|
381
381
|
/**
|
|
382
382
|
* Get the type of the provided value.
|
|
383
383
|
*
|
|
384
|
-
* @param arg The value to check the type of
|
|
384
|
+
* @param arg - The value to check the type of
|
|
385
385
|
*/
|
|
386
386
|
funcType(arg) {
|
|
387
387
|
return (0, typeutils_1.getType)(arg);
|
|
@@ -389,7 +389,7 @@ class Functions {
|
|
|
389
389
|
/**
|
|
390
390
|
* Get the values of the provided object.
|
|
391
391
|
*
|
|
392
|
-
* @param arg The object to get the values of
|
|
392
|
+
* @param arg - The object to get the values of
|
|
393
393
|
*/
|
|
394
394
|
funcValues(arg) {
|
|
395
395
|
return Object.values(arg);
|
|
@@ -409,7 +409,7 @@ class Functions {
|
|
|
409
409
|
* to the `methods` set. Finally, when the recursion collects back to the current instance,
|
|
410
410
|
* it adds the collected methods to the `this.methods` set so that they can be accessed later.
|
|
411
411
|
*
|
|
412
|
-
* @param scope The scope of the class instance to introspect
|
|
412
|
+
* @param scope - The scope of the class instance to introspect
|
|
413
413
|
*/
|
|
414
414
|
introspectMethods(scope) {
|
|
415
415
|
const prototype = Object.getPrototypeOf(this);
|
|
@@ -458,7 +458,7 @@ class Functions {
|
|
|
458
458
|
* }
|
|
459
459
|
* ```
|
|
460
460
|
*
|
|
461
|
-
* @param options The options for the signature decorator
|
|
461
|
+
* @param options - The options for the signature decorator
|
|
462
462
|
*/
|
|
463
463
|
static signature(options) {
|
|
464
464
|
return (_target, _propertyKey, descriptor) => {
|
package/lib/cjs/Lexer.js
CHANGED
|
@@ -54,7 +54,7 @@ class Lexer {
|
|
|
54
54
|
const buff = this.#consumeNumber();
|
|
55
55
|
yield {
|
|
56
56
|
type: 'number',
|
|
57
|
-
value: Number.parseInt(buff),
|
|
57
|
+
value: Number.parseInt(buff, 10),
|
|
58
58
|
start: start,
|
|
59
59
|
end: start + buff.length,
|
|
60
60
|
};
|
|
@@ -148,7 +148,7 @@ class Lexer {
|
|
|
148
148
|
if (buff.length > 1) {
|
|
149
149
|
return {
|
|
150
150
|
type: 'number',
|
|
151
|
-
value: Number.parseInt(buff),
|
|
151
|
+
value: Number.parseInt(buff, 10),
|
|
152
152
|
start: start,
|
|
153
153
|
end: start + buff.length,
|
|
154
154
|
};
|
|
@@ -6,8 +6,8 @@ declare class ParsedResult {
|
|
|
6
6
|
/**
|
|
7
7
|
* Perform a JMESPath search on a JSON value.
|
|
8
8
|
*
|
|
9
|
-
* @param value The JSON value to search
|
|
10
|
-
* @param options The parsing options to use
|
|
9
|
+
* @param value - The JSON value to search
|
|
10
|
+
* @param options - The parsing options to use
|
|
11
11
|
*/
|
|
12
12
|
search(value: JSONObject, options?: JMESPathParsingOptions): unknown;
|
|
13
13
|
}
|
package/lib/cjs/ParsedResult.js
CHANGED
|
@@ -13,8 +13,8 @@ class ParsedResult {
|
|
|
13
13
|
/**
|
|
14
14
|
* Perform a JMESPath search on a JSON value.
|
|
15
15
|
*
|
|
16
|
-
* @param value The JSON value to search
|
|
17
|
-
* @param options The parsing options to use
|
|
16
|
+
* @param value - The JSON value to search
|
|
17
|
+
* @param options - The parsing options to use
|
|
18
18
|
*/
|
|
19
19
|
search(value, options) {
|
|
20
20
|
const interpreter = new TreeInterpreter_js_1.TreeInterpreter(options);
|
package/lib/cjs/Parser.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { ParsedResult } from './ParsedResult.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* Top down operator precedence parser for JMESPath.
|
|
4
4
|
*
|
|
5
|
-
* ## References
|
|
6
5
|
* The implementation of this Parser is based on the implementation of
|
|
7
6
|
* [jmespath.py](https://github.com/jmespath/jmespath.py/), which in turn
|
|
8
7
|
* is based on [Vaughan R. Pratt's "Top Down Operator Precedence"](http://dl.acm.org/citation.cfm?doid=512927.512931).
|
|
@@ -23,7 +22,7 @@ declare class Parser {
|
|
|
23
22
|
* The AST is cached, so if you parse the same expression multiple times,
|
|
24
23
|
* the AST will be returned from the cache.
|
|
25
24
|
*
|
|
26
|
-
* @param expression The JMESPath expression to parse.
|
|
25
|
+
* @param expression - The JMESPath expression to parse.
|
|
27
26
|
*/
|
|
28
27
|
parse(expression: string): ParsedResult;
|
|
29
28
|
/**
|
package/lib/cjs/Parser.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Parser.d.ts","sourceRoot":"","sources":["../../src/Parser.ts"],"names":[],"mappings":"AA4BA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD
|
|
1
|
+
{"version":3,"file":"Parser.d.ts","sourceRoot":"","sources":["../../src/Parser.ts"],"names":[],"mappings":"AA4BA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD;;;;;;;;;;;;GAYG;AACH,cAAM,MAAM;;gBAkBS,SAAS,SAAI;IAIhC;;;;;;;;OAQG;IACI,KAAK,CAAC,UAAU,EAAE,MAAM,GAAG,YAAY;IAc9C;;OAEG;IACI,UAAU,IAAI,IAAI;CA2uB1B;AAED,OAAO,EAAE,MAAM,EAAE,CAAC"}
|