-
-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create an inverse function #13
Comments
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 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 |
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? |
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 |
Turn an object into the minimal set of key paths and values.
The text was updated successfully, but these errors were encountered: