GithubHelp home page GithubHelp logo

Comments (7)

AlexGilleran avatar AlexGilleran commented on May 31, 2024

Thanks @RacingTadpole - is it always when2? I have a feeling it's actually going in reverse sequential order.

from jsx-control-statements.

RacingTadpole avatar RacingTadpole commented on May 31, 2024

Yes - it looks like it is, maybe due to this line: https://github.com/AlexGilleran/jsx-control-statements/blob/master/src/chooseStatement.js#L72 . When I remove the reverse() all the tests still pass, and the test above passes too. I'll submit a PR for that.

We could just define the reverse behaviour to be correct, but that's pretty different from what you'd expect from the analogy with "if-elseif-else". (Eg. the original discussion of this included an example a lot like this, with the "WhenBlock1" answer.)

from jsx-control-statements.

AlexGilleran avatar AlexGilleran commented on May 31, 2024

Yeah agree re: the order.

Any thoughts @texttechne ?

from jsx-control-statements.

texttechne avatar texttechne commented on May 31, 2024

Ahh, I see my mistakes. The most important one is having missed to test ordering 😃

The second mistake is all about reversed ordering.

  • The array of children is reduced from the right side (l.17), so the ordering of when blocks gets reversed.
  • This is the reason I intended to revert them back in the mentioned line 72.
  • Actually this is wrong, because the ternary expression itself is built up from right to left (l.73), which requires reversed ordering...

So @RacingTadpole is completely right with his analysis and bugfix. 👍

from jsx-control-statements.

texttechne avatar texttechne commented on May 31, 2024

We should leave this issue open until it is released.

from jsx-control-statements.

AlexGilleran avatar AlexGilleran commented on May 31, 2024

Released as v3.1.1 :)

from jsx-control-statements.

texttechne avatar texttechne commented on May 31, 2024

👍

from jsx-control-statements.

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.