GithubHelp home page GithubHelp logo

Comments (4)

GaborTorma avatar GaborTorma commented on May 23, 2024 1

Thanx for the pen.

from deepdash.

YuriGor avatar YuriGor commented on May 23, 2024

Hi, by default filterDeep uses Lodash cloneDeep internally, and cloneDeep doesn't support functions (because it's impossible to make good assumption in case of functions, how to clone them)

You can provide your own cloning method, check docs here:
https://deepdash.io/#filterdeep

So instead of default clone method you can create your own, using, for example, cloneDeepWith from Lodash and handle the case of function values as you would like to.

from deepdash.

GaborTorma avatar GaborTorma commented on May 23, 2024

I don't understand exactly. My omitByDeep solution also use _,cloneDeep and handle the functions as well.

from deepdash.

YuriGor avatar YuriGor commented on May 23, 2024

Yeah, that's weird, cloneDeep is inconsistent with clone so it returns functions if they are not on the top level. Here is a discussion about this:
lodash/lodash#3558

In the case of filterDeep - it doesn't clone the whole source object, so functions inside the object, while being cloned, are not deep, so they returned as empty objects, as expected according to Lodash docs.
But in your case functions from the depths of source object remain.
Thank you for the catch, I will analyze how this impacts Deepdash.

BTW here is a fork of your codepen with filterDeep example keeping functions:
https://codepen.io/yurigor/pen/zYvmzaJ?editors=0010

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.