Git Product home page Git Product logo

Comments (2)

polytypic avatar polytypic commented on September 13, 2024

Thanks! Just to recap, the current documentation says that

L.branches(p1, ..., pN) is equivalent to L.branch({[p1]: [], ..., [pN]: []})

which means that the keys are examined in object key order. The proposal is to change the order to match the order of the arguments instead.

🤔

Yeah, I think that change makes sense. It does likely require a bit more code to build the map and it is technically a breaking change, but unlikely to affect most users.

Did you run into a problem due to this?

I could imagine e.g. one using L.forEach with L.branches and being surprised due to the traversal order.

from partial.lenses.

Millsky avatar Millsky commented on September 13, 2024

@polytypic - I was using branches along with a disperse, I had a collection of ids to update.

L.branches(...formIds) the formIds were strings of numbers for example: ['1256', '9807', '123'].

Then I would use L.disperse(myBranchesTraversal, [1,2,3], {}); I guess this is another instance of JS behavior being a bit unexpected. As, when the string keys are put into an object they are sorted and then traversed in that order.

Another option may be to create another orderedBranches that maintains the argument or array order as opposed to the object key order, that way it wouldn't break any users that are relying on the object key order.

Thanks for the quick response by the way!

from partial.lenses.

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.