@@ -196,79 +196,64 @@ Below is a worked example. Given:
196
196
197
197
Evaluating ` abs(foo) ` works as follows:
198
198
199
-
200
199
1 . Evaluate the input argument against the current data:
200
+ ```
201
+ search(foo, {"foo": -1, "bar": 2"}) -> -1
202
+ ```
201
203
202
- ```
203
- search(foo, {"foo": -11, "bar": 2"}) -> -1
204
- ```
205
-
206
-
207
- 2 . Validate the type of the resolved argument. In this case
208
- ` -1 ` is of type ` number ` so it passes the type check.
209
-
204
+ 2 . Validate the type of the resolved argument.
205
+ In this case ` -1 ` is of type ` number ` so it passes the type check.
210
206
211
207
3 . Call the function with the resolved argument:
208
+ ```
209
+ abs(-1) -> 1
210
+ ```
212
211
213
- ```
214
- abs(-1) -> 1
215
- ```
216
-
212
+ 4 . The value of ` 1 ` is the resolved value of the function expression ` abs(foo) ` .
217
213
218
- 4 . The value of ` 1 ` is the resolved value of the function expression
219
-
220
- ` abs(foo) ` .
221
214
222
215
Below is the same steps for evaluating ` abs(bar) ` :
223
216
224
-
225
217
1 . Evaluate the input argument against the current data:
218
+ ```
219
+ search(bar, {"foo": -1, "bar": 2"}) -> "2"
220
+ ```
226
221
227
- ```
228
- search(foo, {"foo": -1, "bar": 2"}) -> "2"
229
- ```
230
-
222
+ 2 . Validate the type of the resolved argument.
223
+ In this case ` "2" ` is of type ` string ` so immediately indicate that an
224
+ ` invalid-type ` error occurred.
231
225
232
- 2 . Validate the type of the resolved argument. In this case
233
- ` "2 ` is of type ` string ` so the immediate indicate that
234
- an ` invalid-type ` error occurred.
235
226
236
227
As a final example, here is the steps for evaluating ` abs(to_number(bar)) ` :
237
228
238
-
239
229
1 . Evaluate the input argument against the current data:
240
-
241
- ```
242
- search(to_number(bar), {"foo": -1, "bar": "2"})
243
- ```
244
-
245
-
246
- 2 . In order to evaluate the above expression, we need to evaluate
247
- ` to_number(bar) ` :
248
-
249
- ```
250
- search(bar, {"foo": -1, "bar": "2"}) -> "2"
251
- # Validate "2" passes the type check for to_number, which it does.
252
- to_number("2") -> 2
253
- ```
254
-
255
-
256
- 3 . Now we can evaluate the original expression:
257
-
258
- ```
259
- search(to_number(bar), {"foo": -1, "bar": "2"}) -> 2
260
- ```
261
-
262
-
263
- 4 . Call the function with the final resolved value:
264
-
265
- ```
266
- abs(2) -> 2
267
- ```
268
-
230
+ ```
231
+ search(to_number(bar), {"foo": -1, "bar": "2"})
232
+ ```
233
+ This requires following the same process for ` to_number(bar) ` :
234
+ 1 . Evaluate the input argument against the current data:
235
+ ```
236
+ search(bar, {"foo": -1, "bar": "2"}) -> "2"
237
+ ```
238
+ 2. Validate the type of the resolved argument.
239
+ In this case `"2"` is of type `string` so it passes the type check.
240
+ 3. Call the function with the resolved argument:
241
+ ```
242
+ to_number("2") -> 2
243
+ ```
244
+ 4. The value of `2` is the resolved value of the function expression
245
+ `to_number(bar)`.
246
+
247
+ 2. Validate the type of the resolved argument.
248
+ In this case `2` is of type `number` so it passes the type check.
249
+
250
+ 3. Call the function with the final resolved argument:
251
+ ```
252
+ abs(2) -> 2
253
+ ```
269
254
270
255
5. The value of `2` is the resolved value of the function expression
271
- ` abs(to_number(bar)) ` .
256
+ `abs(to_number(bar))`.
272
257
273
258
#### Examples
274
259
0 commit comments