Code Monkey home page Code Monkey logo

Comments (4)

YuriGor avatar YuriGor commented on May 28, 2024 1

Hi, currently there is no such method, I'll think about adding it in future release, when I'll have a bit of free time.
If you need it right now you can use reduceDeep instead

from deepdash.

masciugo avatar masciugo commented on May 28, 2024 1

For the sake of completeness, a specific method would be the best solution. But this is my implementation, which is quite satisfying

mapDeep( obj, (value, key, parentValue, context) => {
  if (_.isPlainObject(value)) {
    return _.mapKeys(value, (v,k) => {
      switch (k) {
        case 'id':
          return 'value'
        case 'name':
          return 'label'
        default:
          return k
      }
    })
  } else {
    return value
  }
})

from deepdash.

YuriGor avatar YuriGor commented on May 28, 2024 1

done in v5,0,0
(that was tricky 😅)
mapKeysDeep
also "old" mapDeep was renamed to mapValuesDeep
and implemented again to return just array

from deepdash.

YuriGor avatar YuriGor commented on May 28, 2024

Looks like I've chosen the wrong name for mapDeep.
It actually should be mapValuesDeep, same as in lodash for one preserving object structure to be pair for mapKeysDeep requested above.
And mapDeep is the correct name for 'collectDeep' planned in #42

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.