#StackBounty: #javascript #visual-studio-code VS Code plugin to expand/preview constant data

Bounty: 50

I have a library of mock data that might look like this:

// leafData.js

const emptyFoo = {
    fooData: null; 
}

const typeAFoo = {
    fooData: "typeA"
}

const typeBFoo = {
    fooData: "typeB"
}


//middleData.js 

const emptyMiddle = {
    foos: []
}

const typeAMiddles = {
    foos: [typeAFoo, typeAFoo]
}

const mixedMiddles = {
    foos: [typeAFoo, typeBFoo]
}


//rootData.js 

const scenarioA = {
    middle: emptyMiddle; 
}

const scenarioB = {
    middle: typeAMiddles; 
}

The idea being that tests in different parts of the codebase need to use different types of mock data.

For example there might be a component that only uses leafData and so those different mock types in leafData.js can be used there. Whereas there might be another component that only uses middleData so wants to use those.

The problem I have with the code structured this way is that it’s actually hard to see the shape of the data when using that root data.

What I would like to be able to do is see that data in rootData.js as

const scenarioA = {
    middle: {
         foos: []
    }
}

while keeping the code itself as referencing the data in the other files.

Is there a VSCode plugin that will do this for me?


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.