Skip to content

Sort issue #552

Closed
Closed
@PxyUp

Description

@PxyUp

Hello @antonmedv !

First of all thanks for this one of the best tool which i know!

Here my problem(i am not sure is it problem or suggestion).

I trying sort array here https://expr-lang.org/playground:

sort(Posts) // or sort(Posts, 'desc')

From my point of view like user i am expect results should array with same order/reverse order here the error (as i understand no way to do that right now):

cannot deref <invalid reflect.Value> (3:1)
 | sort(Posts)
 | ^

My suggestion is: create new function which will be do that: sortByIndex(array, order = 'asc|desc') or create reverse. I am prefer for reverse(but may be need support string as well)

Examples:

sortByIndex([3,2,1)) == [3,2,1]
sortByIndex([3,2,1), 'desc') == [1,2,3]
reverse([3,2,1]) == [1,2,3]
reverse(reverse([3,2,1])) == [3,2,1]

I can create pull request with this function

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions