I\'m having trouble looping through an object and changing all the values to something else, let\'s say I want to change all the values to the string \"redacted\". I need to
I wrote a little helper function that walks through an object and applies a callback to each entry:
iterateEntries(node, fn) {
const newNode = {};
Object.entries(node).forEach(([key, val]) => (newNode[key] = fn(val)));
return newNode;
}
Usage:
iterateEntries(yourObject, (entry) => {
return entry; // do something with entry here
});