@@ -138,7 +138,7 @@ data of `["1", "2", "3", "notanumber", true]`, the following expression can
138
138
be used to convert (and filter) all elements to numbers:
139
139
140
140
```
141
- search([].to_number(@), `` ["1", "2", "3", "notanumber", true]`` ) -> [1, 2, 3]
141
+ search([].to_number(@), ["1", "2", "3", "notanumber", true]) -> [1, 2, 3]
142
142
```
143
143
144
144
This provides a simple mechanism to explicitly convert types when needed.
@@ -270,13 +270,14 @@ abs(2) -> 2
270
270
5 . The value of ` 2 ` is the resolved value of the function expression
271
271
` abs(to_number(bar)) ` .
272
272
273
- ### Examples
273
+ #### Examples
274
274
275
275
|Expression|Result
276
276
|---|---
277
277
| ` abs(1) ` |1
278
278
| ` abs(-1) ` |1
279
279
| `` abs(`abc`) `` | |` <error: invalid-type> `
280
+
280
281
### avg
281
282
282
283
```
@@ -287,7 +288,7 @@ Returns the average of the elements in the provided array.
287
288
288
289
An empty array will produce a return value of null.
289
290
290
- ### Examples
291
+ #### Examples
291
292
292
293
|Given|Expression|Result
293
294
|---|---|---
@@ -304,7 +305,7 @@ number ceil(number $value)
304
305
305
306
Returns the next highest integer value by rounding up if necessary.
306
307
307
- ### Examples
308
+ #### Examples
308
309
309
310
|Expression|Result
310
311
| ---| ---|
@@ -313,7 +314,7 @@ Returns the next highest integer value by rounding up if necessary.
313
314
| `` ceil(`1`) `` | 1
314
315
| `` ceil(`abc`) `` | ` null `
315
316
316
- | ### contains
317
+ ### contains
317
318
318
319
```
319
320
boolean contains(array|string $subject, array|object|string|number|boolean $search)
@@ -328,7 +329,7 @@ in the array is equal to the provided `$search` value.
328
329
If the provided ` $subject ` is a string, this function returns true if
329
330
the string contains the provided ` $search ` argument.
330
331
331
- ### Examples
332
+ #### Examples
332
333
333
334
|Given|Expression|Result
334
335
|---|---|---
@@ -349,7 +350,7 @@ number floor(number $value)
349
350
350
351
Returns the next lowest integer value by rounding down if necessary.
351
352
352
- ### Examples
353
+ #### Examples
353
354
354
355
| Expression | Result
355
356
|---|---
@@ -366,7 +367,7 @@ string join(string $glue, array[string] $stringsarray)
366
367
Returns all of the elements from the provided ` $stringsarray ` array joined
367
368
together using the ` $glue ` argument as a separator between each.
368
369
369
- ### Examples
370
+ #### Examples
370
371
371
372
| Given | Expression | Result
372
373
|---|---|---
@@ -383,7 +384,7 @@ array keys(object $obj)
383
384
384
385
Returns an array containing the keys of the provided object.
385
386
386
- ### Examples
387
+ #### Examples
387
388
388
389
| Given | Expression | Result
389
390
|---|---|---
@@ -409,7 +410,7 @@ Returns the length of the given argument using the following types rules:
409
410
410
411
3 . object: returns the number of key-value pairs in the object
411
412
412
- ### Examples
413
+ #### Examples
413
414
414
415
| Given | Expression | Result
415
416
|---|---|---
@@ -431,7 +432,7 @@ Returns the highest found number in the provided array argument.
431
432
432
433
An empty array will produce a return value of null.
433
434
434
- ### Examples
435
+ #### Examples
435
436
436
437
| Given | Expression | Result
437
438
|---|---|---
@@ -446,12 +447,13 @@ number min(array[number] $collection)
446
447
447
448
Returns the lowest found number in the provided ` $collection ` argument.
448
449
449
- ### Examples
450
+ #### Examples
450
451
451
452
| Given | Expression | Result
452
453
|---|--|--
453
454
| ` [10, 15] ` | ` min(@) ` | 10
454
455
| ` [10, false, 20] ` | ` min(@) ` | ` <error: invalid-type> `
456
+
455
457
### sort
456
458
457
459
```
@@ -464,7 +466,7 @@ elements of the `$list` as an array.
464
466
The array must be a list of strings or numbers. Sorting strings is based on
465
467
code points. Locale is not taken into account.
466
468
467
- ### Examples
469
+ #### Examples
468
470
469
471
| Given | Expression | Result
470
472
|---|---|---
@@ -489,7 +491,7 @@ string to_string(string|number|array|object|boolean $arg)
489
491
JSON encoder should emit the encoded JSON value without adding any additional
490
492
new lines.
491
493
492
- ### Examples
494
+ #### Examples
493
495
494
496
| Given | Expression | Result
495
497
|---|---|---
@@ -527,7 +529,7 @@ The return value MUST be one of the following:
527
529
* object
528
530
* null
529
531
530
- ### Examples
532
+ #### Examples
531
533
532
534
| Given | Expression | Result
533
535
|---|---|---
@@ -548,13 +550,14 @@ array values(object $obj)
548
550
549
551
Returns the values of the provided object.
550
552
551
- ### Examples
553
+ #### Examples
552
554
553
555
| Given | Expression | Result
554
556
|---|---|---
555
557
| ` {"foo": "baz", "bar": "bam"} ` | ` values(@) ` | ` ["baz", "bam"] `
556
558
| ` ["a", "b"] ` | ` values(@) ` | ` <error: invalid-type> `
557
559
| ` false ` | ` values(@) ` | ` <error: invalid-type> `
560
+
558
561
## Compliance Tests
559
562
560
563
A ` functions.json ` will be added to the compliance test suite.
0 commit comments