Last active
January 14, 2022 09:03
-
-
Save bartwttewaall/1498ab08bebdf450db0a4d8d35a1570d to your computer and use it in GitHub Desktop.
Sort on multiple properties by priority and ASC/DESC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% for language in languages|sort((a, b) => [b.selected, a.title] <=> [a.selected, b.title]) %} | |
<div class="{{ language.selected ? 'selected' }}">{{ language.title }}</div> | |
{% endfor %} | |
{# The order of properties determines priority #} | |
{# The order of a or b determines ASC or DESC sorting #} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment