GithubHelp home page GithubHelp logo

Comments (3)

melnikov-s avatar melnikov-s commented on July 22, 2024

After further investigation I found this: ariya/phantomjs#11090

Seems like for whatever reason phantomjs reverses the parameters passed into sort and this is something that might get resolved in phantomjs 2.0 .

So perhaps swapping the aforementioned lines might be the solution to this bug. Especially if you're not using phantomjs to run your automated tests.

from ampersand-collection.

aaronmccall avatar aaronmccall commented on July 22, 2024

This is an interesting one. I wonder if maybe it would be better to simply return 0 when both left and right are undefined.

from ampersand-collection.

melnikov-s avatar melnikov-s commented on July 22, 2024

https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/sort

If compareFunction(a, b) returns 0, leave a and b unchanged with respect to each other, but sorted with respect to all different elements. Note: the ECMAscript standard does not guarantee this behaviour, and thus not all browsers (e.g. Mozilla versions dating back to at least 2003) respect this.

So I'm not so sure about return 0. I can create a PR for my suggested fix it should be fairly low impact.

from ampersand-collection.

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.