Code Monkey home page Code Monkey logo

Comments (3)

robross0606 avatar robross0606 commented on July 24, 2024 2

@YuriGor yep, reduceDeep is already precisely what I ended up using. I would have responded sooner, but I purposely took a breather to avoid getting baited by clear trolling from @dkdev030. Thanks for the advice and, yes, the library is clearly useful. 😁

from deepdash.

dkdev030 avatar dkdev030 commented on July 24, 2024

Hello @robross0606 ,

i just stumpled over this issue. A few things.
First your issue is pretty rude not to say disrespectful formulated. @YuriGor does a really great job and i am sure you have to admit that, too.

Also since Deepdash uses Lodash, there are a lot of easy ways to circumvent your issue and get the desired result.

// 1. use the `condense`-option `filterDeep` or `pickDeep` so that the initilal structure is preserved. 
const deepFilteredResults = _.filterDeep(obj, predicate, { condense: true });

// 2. create the paths out of the result
const paths = _.paths(deepFilteredResults)

// 3. get the result
const values = paths.map((path) => _.get(obj, path)

from deepdash.

YuriGor avatar YuriGor commented on July 24, 2024

Hi @robross0606 you can use reduceDeep
just use array as accumulator and push only values you need.
I wanted to implement something like selectDeep to do such things, but I have no need/free time for this.
Feel free to open PR if you'd like.

Thanks @dkdev030 yes you suggest would also work but, if preserving structure is not needed - better to not use filterDeep because it spends resources under the hood to preserve such structure.

from deepdash.

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.