Code Monkey home page Code Monkey logo

Comments (5)

jdalton avatar jdalton commented on April 28, 2024

Yap. That is intended.

Lo-Dash is really focused on optimizing for the documented/test/common usage of methods. In the case of flattening objects, Underscore's support is an unintended side effect of their overuse/dependency on _.each.

from lodash.

idosela avatar idosela commented on April 28, 2024

Thanks for the quick reply.

from lodash.

mikeymckay avatar mikeymckay commented on April 28, 2024

I just ran into this problem after doing a "drop-in" replacement of underscore with lodash. It would be helpful to post a workaround here... I will if I figure it out before google does.

Ok, easy enough. I had code that looked like this:

    _.chain(FacilityHierarchy.hierarchy).flatten().values().pluck("facility").value()

After a few minutes of investigation I realized that I just needed to call values first (as I should have even with underscore), and it worked fine:

    _.chain(FacilityHierarchy.hierarchy).values().flatten().pluck("facility").value()

Posting it here in case it helps anybody else.

from lodash.

jdalton avatar jdalton commented on April 28, 2024

Underscore 1.7.0 no longer supports objects in their _.flatten implementation. For example
_.flatten({name:['abc']}) returns [].

Related to jashkenas/underscore#1805.

from lodash.

lock avatar lock commented on April 28, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

from lodash.

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.