deeply nested object literals
See original GitHub issueCurrently deeply nested object literals will be formatted in a collapsed form.
This behavior is nice for simple object literals, but for deeply nested ones it would be nice to have the nested properties indented. Maybe a complexity level (like for Arrow expressions) would be nice here.
source
var simple = {
name:'a'
}
var deeplyNested = {
name:'f',
nested: {
nested: {
nested: {
nested: {
nested: {
nested: {
nested: {
name: 'a'
}
}
}
}
}
}
}
};
formatted
var simple = {name: 'a'};
var test = {
name: 'f',
nested: {
nested: {nested: {nested: {nested: {nested: {nested: {name: 'a'}}}}}}
}
};
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Flattening a deeply nested array of literals in JavaScript
The function should construct a new array that contains all the literal elements present in the input array but without nesting.
Read more >How to explore a deeply nested object structure more easily?
Object Literal and spread operator makes creating deeply nested object very easy. But from time to time I have to read the code...
Read more >How to safely work with nested objects in JavaScript
Safely setting values for deeply nested objects. Using Lodash. We can use Lodash's set function. Below is the syntax set(object, path, value).
Read more >Using ES6 To Destructure Deeply Nested Objects in ... - ITNEXT
Today, I will show you how to use ES6 to destructure nested objects, my friends, AND what's more, prevent the dreaded undefined error...
Read more >How to Merge Deeply Nested Objects in JavaScript
There are many scenarios where we need to merge two objects that may be deeply nested. In this article, we will see how...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
As another real-world example, here’s an excerpt from a
brunch-config.js
(for brunch) file in one of my projects after running prettier on it:https://github.com/jlongster/prettier/issues/74 is also talking about the same issue, let’s condensate them into one. Closing this one.