Make an object with the same structure but modified values
I'm trying to do some cool stuff with .mdx as strings being parsed in getStaticProps and got to an ok point but everything went to shit when I tried to put those strings into an object since I need to serialize them and want to keep the object structure for that sweet autocomplete in the frontend.
Long context out of the way, let's say I have:
How should I go about making another object, with the same structure and keys but where every string got passed to a
serialize
function I have?
I tried something like
but kept going in circles with no success
Hope everything here made sense because I really need help with this3 Replies
https://stackoverflow.com/a/38829074 looks promising?
Stack Overflow
map function for objects (instead of arrays)
I have an object:
myObject = { 'a': 1, 'b': 2, 'c': 3 }
I am looking for a native method, similar to Array.prototype.map that would be used as follows:
newObject = myObject.map(function (value, ...
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
taking this step back and looking at it as a clone helped so much, ty!