Code Monkey home page Code Monkey logo

Comments (5)

mmkal avatar mmkal commented on July 19, 2024 2

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 .sort() wherever I'm accidentally depending on it, but I imagine there are others who will find the reverse order unexpected and might hit issues.

Failing that, would you accept a docs update pull request?

from node-glob.

isaacs avatar isaacs commented on July 19, 2024

They're not sorted at all, and the order is non deterministic, set by os latency. Do not depend on it.

from node-glob.

1j01 avatar 1j01 commented on July 19, 2024

Version 9 removed sorting. To sort results just as version 8 did, use:

glob.sync(...).sort((a, b)=> a.localeCompare(b, 'en'))

from node-glob.

isaacs avatar isaacs commented on July 19, 2024

They do seem to consistently be in reverse order though, for the cases I've tried.

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.

from node-glob.

isaacs avatar isaacs commented on July 19, 2024

And yes, doc patch welcome 🤗

from node-glob.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.