@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/lib/esm/Expression.js
CHANGED
|
@@ -11,9 +11,8 @@ class Expression {
|
|
|
11
11
|
/**
|
|
12
12
|
* Evaluate the expression against a JSON value.
|
|
13
13
|
*
|
|
14
|
-
* @param value The JSON value to apply the expression to.
|
|
15
|
-
* @param node The node to visit.
|
|
16
|
-
* @returns The result of applying the expression to the value.
|
|
14
|
+
* @param value - The JSON value to apply the expression to.
|
|
15
|
+
* @param node - The node to visit.
|
|
17
16
|
*/
|
|
18
17
|
visit(value, node) {
|
|
19
18
|
return this.#interpreter.visit(node ?? this.#expression, value);
|
package/lib/esm/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/esm/Functions.js
CHANGED
|
@@ -45,7 +45,7 @@ class Functions {
|
|
|
45
45
|
/**
|
|
46
46
|
* Get the absolute value of the provided number.
|
|
47
47
|
*
|
|
48
|
-
* @param args The number to get the absolute value of
|
|
48
|
+
* @param args - The number to get the absolute value of
|
|
49
49
|
*/
|
|
50
50
|
funcAbs(args) {
|
|
51
51
|
return Math.abs(args);
|
|
@@ -53,7 +53,7 @@ class Functions {
|
|
|
53
53
|
/**
|
|
54
54
|
* Calculate the average of the numbers in the provided array.
|
|
55
55
|
*
|
|
56
|
-
* @param args The numbers to average
|
|
56
|
+
* @param args - The numbers to average
|
|
57
57
|
*/
|
|
58
58
|
funcAvg(args) {
|
|
59
59
|
return args.reduce((a, b) => a + b, 0) / args.length;
|
|
@@ -61,7 +61,7 @@ class Functions {
|
|
|
61
61
|
/**
|
|
62
62
|
* Get the ceiling of the provided number.
|
|
63
63
|
*
|
|
64
|
-
* @param args The number to get the ceiling of
|
|
64
|
+
* @param args - The number to get the ceiling of
|
|
65
65
|
*/
|
|
66
66
|
funcCeil(args) {
|
|
67
67
|
return Math.ceil(args);
|
|
@@ -69,8 +69,8 @@ class Functions {
|
|
|
69
69
|
/**
|
|
70
70
|
* Determine if the given value is contained in the provided array or string.
|
|
71
71
|
*
|
|
72
|
-
* @param haystack The array or string to check
|
|
73
|
-
* @param needle The value to check for
|
|
72
|
+
* @param haystack - The array or string to check
|
|
73
|
+
* @param needle - The value to check for
|
|
74
74
|
*/
|
|
75
75
|
funcContains(haystack, needle) {
|
|
76
76
|
return haystack.includes(needle);
|
|
@@ -78,8 +78,8 @@ class Functions {
|
|
|
78
78
|
/**
|
|
79
79
|
* Determines if the provided string ends with the provided suffix.
|
|
80
80
|
*
|
|
81
|
-
* @param str The string to check
|
|
82
|
-
* @param suffix The suffix to check for
|
|
81
|
+
* @param str - The string to check
|
|
82
|
+
* @param suffix - The suffix to check for
|
|
83
83
|
*/
|
|
84
84
|
funcEndsWith(str, suffix) {
|
|
85
85
|
return str.endsWith(suffix);
|
|
@@ -87,7 +87,7 @@ class Functions {
|
|
|
87
87
|
/**
|
|
88
88
|
* Get the floor of the provided number.
|
|
89
89
|
*
|
|
90
|
-
* @param args The number to get the floor of
|
|
90
|
+
* @param args - The number to get the floor of
|
|
91
91
|
*/
|
|
92
92
|
funcFloor(args) {
|
|
93
93
|
return Math.floor(args);
|
|
@@ -95,8 +95,8 @@ class Functions {
|
|
|
95
95
|
/**
|
|
96
96
|
* Join the provided array into a single string.
|
|
97
97
|
*
|
|
98
|
-
* @param separator The separator to use
|
|
99
|
-
* @param items The array of itmes to join
|
|
98
|
+
* @param separator - The separator to use
|
|
99
|
+
* @param items - The array of itmes to join
|
|
100
100
|
*/
|
|
101
101
|
funcJoin(separator, items) {
|
|
102
102
|
return items.join(separator);
|
|
@@ -104,7 +104,7 @@ class Functions {
|
|
|
104
104
|
/**
|
|
105
105
|
* Get the keys of the provided object.
|
|
106
106
|
*
|
|
107
|
-
* @param arg The object to get the keys of
|
|
107
|
+
* @param arg - The object to get the keys of
|
|
108
108
|
*/
|
|
109
109
|
funcKeys(arg) {
|
|
110
110
|
return Object.keys(arg);
|
|
@@ -112,7 +112,7 @@ class Functions {
|
|
|
112
112
|
/**
|
|
113
113
|
* Get the number of items in the provided item.
|
|
114
114
|
*
|
|
115
|
-
* @param arg The array to get the length of
|
|
115
|
+
* @param arg - The array to get the length of
|
|
116
116
|
*/
|
|
117
117
|
funcLength(arg) {
|
|
118
118
|
if (isRecord(arg)) {
|
|
@@ -123,8 +123,8 @@ class Functions {
|
|
|
123
123
|
/**
|
|
124
124
|
* Map the provided function over the provided array.
|
|
125
125
|
*
|
|
126
|
-
* @param expression The expression to map over the array
|
|
127
|
-
* @param args The array to map the expression over
|
|
126
|
+
* @param expression - The expression to map over the array
|
|
127
|
+
* @param args - The array to map the expression over
|
|
128
128
|
*/
|
|
129
129
|
funcMap(expression, args) {
|
|
130
130
|
return args.map((arg) => {
|
|
@@ -134,7 +134,7 @@ class Functions {
|
|
|
134
134
|
/**
|
|
135
135
|
* Get the maximum value in the provided array.
|
|
136
136
|
*
|
|
137
|
-
* @param arg The array to get the maximum value of
|
|
137
|
+
* @param arg - The array to get the maximum value of
|
|
138
138
|
*/
|
|
139
139
|
funcMax(arg) {
|
|
140
140
|
if (arg.length === 0) {
|
|
@@ -150,8 +150,8 @@ class Functions {
|
|
|
150
150
|
/**
|
|
151
151
|
* Get the item in the provided array that has the maximum value when the provided expression is evaluated.
|
|
152
152
|
*
|
|
153
|
-
* @param args The array of items to get the maximum value of
|
|
154
|
-
* @param expression The expression to evaluate for each item in the array
|
|
153
|
+
* @param args - The array of items to get the maximum value of
|
|
154
|
+
* @param expression - The expression to evaluate for each item in the array
|
|
155
155
|
*/
|
|
156
156
|
funcMaxBy(args, expression) {
|
|
157
157
|
if (args.length === 0) {
|
|
@@ -187,7 +187,7 @@ class Functions {
|
|
|
187
187
|
*
|
|
188
188
|
* Note that this is a shallow merge and will not merge nested objects.
|
|
189
189
|
*
|
|
190
|
-
* @param args The objects to merge
|
|
190
|
+
* @param args - The objects to merge
|
|
191
191
|
*/
|
|
192
192
|
funcMerge(...args) {
|
|
193
193
|
// biome-ignore lint/performance/noAccumulatingSpread: This is a shallow merge so the tradeoff is acceptable
|
|
@@ -196,7 +196,7 @@ class Functions {
|
|
|
196
196
|
/**
|
|
197
197
|
* Get the minimum value in the provided array.
|
|
198
198
|
*
|
|
199
|
-
* @param arg The array to get the minimum value of
|
|
199
|
+
* @param arg - The array to get the minimum value of
|
|
200
200
|
*/
|
|
201
201
|
funcMin(arg) {
|
|
202
202
|
if (arg.length === 0) {
|
|
@@ -211,8 +211,8 @@ class Functions {
|
|
|
211
211
|
/**
|
|
212
212
|
* Get the item in the provided array that has the minimum value when the provided expression is evaluated.
|
|
213
213
|
*
|
|
214
|
-
* @param args The array of items to get the minimum value of
|
|
215
|
-
* @param expression The expression to evaluate for each item in the array
|
|
214
|
+
* @param args - The array of items to get the minimum value of
|
|
215
|
+
* @param expression - The expression to evaluate for each item in the array
|
|
216
216
|
*/
|
|
217
217
|
funcMinBy(args, expression) {
|
|
218
218
|
if (args.length === 0) {
|
|
@@ -247,7 +247,7 @@ class Functions {
|
|
|
247
247
|
* Get the first argument that does not evaluate to null.
|
|
248
248
|
* If all arguments evaluate to null, then null is returned.
|
|
249
249
|
*
|
|
250
|
-
* @param args The keys of the items to check
|
|
250
|
+
* @param args - The keys of the items to check
|
|
251
251
|
*/
|
|
252
252
|
funcNotNull(...args) {
|
|
253
253
|
return args.find((arg) => !Object.is(arg, null)) || null;
|
|
@@ -255,7 +255,7 @@ class Functions {
|
|
|
255
255
|
/**
|
|
256
256
|
* Reverses the provided string or array.
|
|
257
257
|
*
|
|
258
|
-
* @param arg The string or array to reverse
|
|
258
|
+
* @param arg - The string or array to reverse
|
|
259
259
|
*/
|
|
260
260
|
funcReverse(arg) {
|
|
261
261
|
return Array.isArray(arg)
|
|
@@ -265,7 +265,7 @@ class Functions {
|
|
|
265
265
|
/**
|
|
266
266
|
* Sort the provided array.
|
|
267
267
|
*
|
|
268
|
-
* @param arg The array to sort
|
|
268
|
+
* @param arg - The array to sort
|
|
269
269
|
*/
|
|
270
270
|
funcSort(arg) {
|
|
271
271
|
return arg.sort((a, b) => {
|
|
@@ -283,8 +283,8 @@ class Functions {
|
|
|
283
283
|
/**
|
|
284
284
|
* Sort the provided array by the provided expression.
|
|
285
285
|
*
|
|
286
|
-
* @param args The array to sort
|
|
287
|
-
* @param expression The expression to sort by
|
|
286
|
+
* @param args - The array to sort
|
|
287
|
+
* @param expression - The expression to sort by
|
|
288
288
|
*/
|
|
289
289
|
funcSortBy(args, expression) {
|
|
290
290
|
return args
|
|
@@ -319,8 +319,8 @@ class Functions {
|
|
|
319
319
|
/**
|
|
320
320
|
* Determines if the provided string starts with the provided prefix.
|
|
321
321
|
*
|
|
322
|
-
* @param str The string to check
|
|
323
|
-
* @param prefix The prefix to check for
|
|
322
|
+
* @param str - The string to check
|
|
323
|
+
* @param prefix - The prefix to check for
|
|
324
324
|
*/
|
|
325
325
|
funcStartsWith(str, prefix) {
|
|
326
326
|
return str.startsWith(prefix);
|
|
@@ -328,7 +328,7 @@ class Functions {
|
|
|
328
328
|
/**
|
|
329
329
|
* Sum the provided numbers.
|
|
330
330
|
*
|
|
331
|
-
* @param args The numbers to sum
|
|
331
|
+
* @param args - The numbers to sum
|
|
332
332
|
*/
|
|
333
333
|
funcSum(args) {
|
|
334
334
|
return args.reduce((a, b) => a + b, 0);
|
|
@@ -339,7 +339,7 @@ class Functions {
|
|
|
339
339
|
* If the provided value is an array, then it is returned.
|
|
340
340
|
* Otherwise, the value is wrapped in an array and returned.
|
|
341
341
|
*
|
|
342
|
-
* @param arg The items to convert to an array
|
|
342
|
+
* @param arg - The items to convert to an array
|
|
343
343
|
*/
|
|
344
344
|
funcToArray(arg) {
|
|
345
345
|
return Array.isArray(arg) ? arg : [arg];
|
|
@@ -352,7 +352,7 @@ class Functions {
|
|
|
352
352
|
*
|
|
353
353
|
* If the value cannot be converted to a number, then null is returned.
|
|
354
354
|
*
|
|
355
|
-
* @param arg The value to convert to a number
|
|
355
|
+
* @param arg - The value to convert to a number
|
|
356
356
|
*/
|
|
357
357
|
funcToNumber(arg) {
|
|
358
358
|
if (typeof arg === 'number') {
|
|
@@ -370,7 +370,7 @@ class Functions {
|
|
|
370
370
|
* If the provided value is a string, then it is returned.
|
|
371
371
|
* Otherwise, the value is converted to a string and returned.
|
|
372
372
|
*
|
|
373
|
-
* @param arg The value to convert to a string
|
|
373
|
+
* @param arg - The value to convert to a string
|
|
374
374
|
*/
|
|
375
375
|
funcToString(arg) {
|
|
376
376
|
return typeof arg === 'string' ? arg : JSON.stringify(arg);
|
|
@@ -378,7 +378,7 @@ class Functions {
|
|
|
378
378
|
/**
|
|
379
379
|
* Get the type of the provided value.
|
|
380
380
|
*
|
|
381
|
-
* @param arg The value to check the type of
|
|
381
|
+
* @param arg - The value to check the type of
|
|
382
382
|
*/
|
|
383
383
|
funcType(arg) {
|
|
384
384
|
return getType(arg);
|
|
@@ -386,7 +386,7 @@ class Functions {
|
|
|
386
386
|
/**
|
|
387
387
|
* Get the values of the provided object.
|
|
388
388
|
*
|
|
389
|
-
* @param arg The object to get the values of
|
|
389
|
+
* @param arg - The object to get the values of
|
|
390
390
|
*/
|
|
391
391
|
funcValues(arg) {
|
|
392
392
|
return Object.values(arg);
|
|
@@ -406,7 +406,7 @@ class Functions {
|
|
|
406
406
|
* to the `methods` set. Finally, when the recursion collects back to the current instance,
|
|
407
407
|
* it adds the collected methods to the `this.methods` set so that they can be accessed later.
|
|
408
408
|
*
|
|
409
|
-
* @param scope The scope of the class instance to introspect
|
|
409
|
+
* @param scope - The scope of the class instance to introspect
|
|
410
410
|
*/
|
|
411
411
|
introspectMethods(scope) {
|
|
412
412
|
const prototype = Object.getPrototypeOf(this);
|
|
@@ -455,7 +455,7 @@ class Functions {
|
|
|
455
455
|
* }
|
|
456
456
|
* ```
|
|
457
457
|
*
|
|
458
|
-
* @param options The options for the signature decorator
|
|
458
|
+
* @param options - The options for the signature decorator
|
|
459
459
|
*/
|
|
460
460
|
static signature(options) {
|
|
461
461
|
return (_target, _propertyKey, descriptor) => {
|
package/lib/esm/Lexer.js
CHANGED
|
@@ -51,7 +51,7 @@ class Lexer {
|
|
|
51
51
|
const buff = this.#consumeNumber();
|
|
52
52
|
yield {
|
|
53
53
|
type: 'number',
|
|
54
|
-
value: Number.parseInt(buff),
|
|
54
|
+
value: Number.parseInt(buff, 10),
|
|
55
55
|
start: start,
|
|
56
56
|
end: start + buff.length,
|
|
57
57
|
};
|
|
@@ -145,7 +145,7 @@ class Lexer {
|
|
|
145
145
|
if (buff.length > 1) {
|
|
146
146
|
return {
|
|
147
147
|
type: 'number',
|
|
148
|
-
value: Number.parseInt(buff),
|
|
148
|
+
value: Number.parseInt(buff, 10),
|
|
149
149
|
start: start,
|
|
150
150
|
end: start + buff.length,
|
|
151
151
|
};
|
|
@@ -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/esm/ParsedResult.js
CHANGED
|
@@ -10,8 +10,8 @@ class ParsedResult {
|
|
|
10
10
|
/**
|
|
11
11
|
* Perform a JMESPath search on a JSON value.
|
|
12
12
|
*
|
|
13
|
-
* @param value The JSON value to search
|
|
14
|
-
* @param options The parsing options to use
|
|
13
|
+
* @param value - The JSON value to search
|
|
14
|
+
* @param options - The parsing options to use
|
|
15
15
|
*/
|
|
16
16
|
search(value, options) {
|
|
17
17
|
const interpreter = new TreeInterpreter(options);
|
package/lib/esm/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/esm/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"}
|