Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sorting option #37

Closed
wants to merge 3 commits into from
Closed

Add sorting option #37

wants to merge 3 commits into from

Conversation

m90
Copy link

@m90 m90 commented Oct 18, 2015

I just ran into the same issue as #35, so I thought I'd give it a go. Instead of defining custom sort options I went for enabling sorting all keys available on fs.Stat.

Edit: I am a little confused as far as the CI errors go, as they seem to be installation problems (the tests don't run in the first place), yet all I did to ensure passing CI is running the tests locally on my machine (node 4.1.2) so they still might fail in other envs. Any insight on what exactly is failing is welcome.

when passing a `sorting` key to the options the file listings can be served
on other keys than name, additionally the sorting oder can be reversed by
prefixing the key with a `-`
@dougwilson
Copy link
Contributor

Don't worry about the test failure, I see what it is and something I need to fix :)

As for the sort, that is awesome, but why not just let the option be a function instead of a string? When customizing sorting, I've seen most people want to be able to keep folders separate, mix the folders and files, sort by name case sensitive, sort by name case insensitive, and use Intl functions to sort foreign language names correctly.

The new sort functionality should at least be able to achieve these popular things :)

@m90
Copy link
Author

m90 commented Oct 18, 2015

I thought the same thing but somehow decided to go for the stat keys.
Probably because that's what I need in my particular case....

Passing a function for sorting sounds good though. Would you disable
passing strings completely or opt for both possibilities?

instead of limiting sorting options to the keys in stat, enable passing a
function so sorting is as flexible as possible
@dougwilson dougwilson self-assigned this Jan 15, 2016
@dougwilson dougwilson added the pr label Jan 15, 2016
@m90 m90 closed this Jul 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants