-
-
Notifications
You must be signed in to change notification settings - Fork 482
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
results are in reverse alphabetical order #576
Comments
They're not sorted at all, and the order is non deterministic, set by os latency. Do not depend on it. |
That's good to know! They do seem to consistently be in reverse order though, for the cases I've tried. Do you think there's something that got changed recently that caused that? I'll make sure to add a Failing that, would you accept a docs update pull request? |
Version 9 removed sorting. To sort results just as version 8 did, use: glob.sync(...).sort((a, b)=> a.localeCompare(b, 'en')) |
That is 100% a result of how your computer's file system chooses to return results. On a different operating system, file system, disk controller, ..., it could easily be returned in alphabetical order, in order of last access, entirely random, or any other arbitrary order. Sort if you depend on it, don't depend on it if you're not sorting it yourself. |
And yes, doc patch welcome 🤗 |
thanks for pointing this out.. IMO, it's better we do our own sorting - v8 assumed all users require American English sorting (as you highlighted) which results in incorrectly sorted output for non-Americans.. Russian speakers, for example..
|
Hi! It seems in v10, results are in reverse alphabetical order.
Repro: go to https://npm.runkit.com/glob and paste in:
This was not the case in glob v8. Not sure about 9.
The text was updated successfully, but these errors were encountered: