Skip to content

Commit e6e376a

Browse files
committed
Update sortBy docs
1 parent b2a0c2a commit e6e376a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

docs/language-definition.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ filter(posts, {
305305
any(.Comments, .Author == post.Author)
306306
})
307307
```
308+
308309
:::
309310

310311
## String Functions
@@ -691,7 +692,7 @@ Returns the sum of all numbers in the array.
691692
sum([1, 2, 3]) == 6
692693
```
693694

694-
If the optional `predicate` argument is given, it is a predicate that is applied on each element
695+
If the optional `predicate` argument is given, it is a predicate that is applied on each element
695696
of the array before summing.
696697

697698
```expr
@@ -765,14 +766,14 @@ sort([3, 1, 4]) == [1, 3, 4]
765766
sort([3, 1, 4], "desc") == [4, 3, 1]
766767
```
767768

768-
### sortBy(array, key[, order]) {#sortBy}
769+
### sortBy(array[, predicate, order]) {#sortBy}
769770

770-
Sorts an array of maps by a specific key in ascending order. Optional `order` argument can be used to specify the order
771+
Sorts an array by the result of the [predicate](#predicate). Optional `order` argument can be used to specify the order
771772
of sorting: `asc` or `desc`.
772773

773774
```expr
774-
sortBy(users, "Age")
775-
sortBy(users, "Age", "desc")
775+
sortBy(users, .Age)
776+
sortBy(users, .Age, "desc")
776777
```
777778

778779
## Map Functions

0 commit comments

Comments
 (0)