GithubHelp home page GithubHelp logo

Create an inverse function about dset HOT 3 CLOSED

lukeed avatar lukeed commented on August 18, 2024
Create an inverse function

from dset.

Comments (3)

00000o1 avatar 00000o1 commented on August 18, 2024 1

Ah, @lukeed you already did this! 😂 Amazing you come up with some many useful, specific utilities. True skill you have. Very cool.

BTW I meant your second case. So https://github.com/lukeed/flat-obj covers that for objects. Does it also work if arrays are in the structure?

from dset.

lukeed avatar lukeed commented on August 18, 2024 1

Haha, thanks! There are lots of them I learned (over time) but I just write things that I need when I needed them, especially when I was getting started. I think that module was one of my first modules ever, too

It will handle array keys but the initial item has to be an object

from dset.

lukeed avatar lukeed commented on August 18, 2024

Hey, I'm not sure if I'm understanding correctly.

Are you looking to get the deeply-nested values via a keypath? If so, then dlv covers that for you.

Or, are you wanting to convert an object into a flat object with values?

let obj = {
  a: 1,
  b: {
    c: 3,
    d: {
      e: 5
    }
  }
}

//=>

{
  a: 1,
  'b.c': 3,
  'b.d.e': 5
}

If that's the case, then you can use flat-obj and change the glue to '.' (or whatever you want).

from dset.

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.