Comments (3)
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.
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.
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)
- Not really an issue. HOT 1
- Non-integers treated as valid indices for created arrays HOT 3
- Accept numbers as path elements HOT 2
- Immutable structures cannot be used unless a copy is created HOT 1
- Prototype pollution vulnerability HOT 1
- Break loop on magical key? HOT 2
- Possibility to delete properties by path? HOT 1
- Trying to get in touch regarding a security issue HOT 2
- Strange bug using dset with mobx
- Question: why did you not choose the while loop? HOT 1
- Consider adding array merge strategy option HOT 1
- Merging objects at the root results in a no-op
- Prototype pollution vulnerability in merge function HOT 3
- `dset` creates array instead of object for nested empty string property
- `dset` throws when encountering `null` in object
- Returning the modified object would simplify immutability
- dget? HOT 2
- Use UMD HOT 1
- Does this modify the objects? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dset.